开发者

Why does IIS refuse my Code.Behind tag?

开发者 https://www.devze.com 2023-04-11 09:19 出处:网络
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.

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 Webserv开发者_Python百科ice 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消