当前位置: 动力学知识库 > 问答 > 编程问答 >

ASP.NET compiler on IIS can't see my Designer.cs files

问题描述:

I am trying to deploy a simple ASP.NET 4.0 Web Application on IIS 6.0 on Windows Server 2003.

I've copied all of the files over, including the bin folder and files Play.aspx, Play.aspx.cs and Play.aspx.designer.cs.

I get the following error when I try to access Play.aspx in the browser:

Compiler Error Message: CS0103: The name 'divOutput' does not exist in the current context

and then it quotes a line from my Play.aspx.cs file.

Now, divOutput does exist in the Play.aspx.designer.cs file. Why is the ASP.NET compiler on the server not picking this up? (And anyway, I've copied the bin folder, so why is it even trying to compile anything in the first place?)

网友答案:

Deploying source to a server is rarely (as in Never) a good idea and usually the wrong way to do things.

Use the Publish command in visual studio. This will compile and deploy for you.

网友答案:

Make sure that your codebehind and designer share the same classname. Sometimes if you rename stuff manually this can get out of whack.

Ensure that the designer is included in the project.

Make sure that the aspx references the proper code behind and class name.

分享给朋友:
您可能感兴趣的文章:
随机阅读: