Reputation: 5389
I have created a small webservice, I ran it in Visual Studio Development Server
and it ran fine. I then decided to run it (still through Visual Studio) onto IIS
.
My Webservice refused to work until I removed the Code.Behind
attribute from the Webservice element in the asmx markup. Now it runs flawlessly.
Could anyone explain to me the reason?
Edit: By refused to work, I mean I got an error page stating This page must have a <%@ webservice class ... %> directive
, which it had. As to "where was the code", I have a markup containing that line, and the asmx.cs file that contains the class implementation. Bear in mind that this code worked, and without the element now it also works, so it's the difference of behavior between VSDS and IIS that lets me perplexed.
Upvotes: 0
Views: 205
Reputation: 5480
The CodeBehind attribute used in a page or webservice directive isn't used at runtime. It's only used by Visual Studio so it knows the associated .cs or .vb file.
The class attribute for web services or the inherits for pages tells it's what class to use at runtime. If it's a website rather than a web project, then codefile is used at runtime to find associated code for the page.
An error message would help figure out what the problem you're getting.
Upvotes: 1