IIS searches for a .cs file on a compiled .net site

I am creating my first ASP.Net web application project in VS2010. The site has a main page that uses all content pages.

I published it on a local Windows 2008 R2 server that is running IIS 7.5, so other team members can look.

I published it using the "File System" in a directory on the server. If I look in the directory on the server, all I see are .aspx files and a few dlls - this is what I expect.

If I go to IIS and try to browse the web application (or open a browser in my local field and go to http://myserver/Contacts - I will get a server error - "The Contacts / MasterPage1.master.cs file" does not exist.

I do not understand - why is IIS looking for a .cs file when all .cs files are compiled in a dll in a web application project?

+6
source share
1 answer

Check out a few things:

  • Check if you are CodeFile="..." to the type of the main page using the attributes CodeFile="..." or CodeBehind="..." . If you use CodeFile change to CodeBehind or even better, right-click on your project and click "Convert to Web Project"

  • Try adding a namespace when accessing the main page ( Inherits="Project.MasterPage" )

+13
source

Source: https://habr.com/ru/post/901094/


All Articles