简体   繁体   中英

Publishing .NET 4.5 ASP.NET website on IIS 7.0 yields an error 404 though the files exist

I am trying to deploy my first ASP.NET application on a server running IIS 7. But I always get an error 404 when trying to open the page. I thought it might be a start page issue, so I entered a direct URL to a .aspx file inside the wwwroot folder, but that got me another 404. Next step was to set a start page in the IIS Manager to a certain .aspx file, which made the page open, but the URL shown didn't include the specific page, and I didn't see my bootstrap navbar (just links that should be inside it) nor my Infragistics components. (To give context, we just upgraded the server to .NET 4.5 this morning, but all other ASP.NET websites in the same or other application pools still work perfectly!).

I then enabled the option to see folder contents in the browser; opening the website then showed me all the files that were supposedly not found, but clicking on them gave me 404 again. For testing purposes I put a .html inside the main folder: that one I could click and open, as well as *.css files or images in subfolders. But as I said above: ASP.NET is installed and working for all the other websites. I checked the MIME things, there is nothing for ASP related files, but neither is there in the working projects. The handler mappings seem to be correct as well.

So what could the reason for this be? I am totally unacquainted with IIS, so I lack any ideas beyond simple googling :/ My guess would be something permission-related (the app pool it's currently in is using pipeline mode: classic; but again, the same as the working stuff) or another dynamic content option I missed. Or - since as soon as I manually define a start page to be one of the .aspx files, I see at least something - it could be related to extensionless URL's? When I manually enter

myservername\\myappname\\StartPage.aspx

the browser at least shows

myservername\\myappname\\StartPage

instead. But I can't seem to find an option to change this. Any help is greatly appreciated!

I ran into this issue when I first started working with ASP.NET. I spent hours scratching my head trying to figure out what was the problem. After a fair bit of research this is what solved my problem. I added the flowing code in the web.config file.

 <system.webServer>

<modules runAllManagedModulesForAllRequests="true"></modules> 

</system.webServer> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM