简体   繁体   中英

Issue hosting ASP.NET MVC 4 application using IIS 7.5 after creating virtual directory - Script files are not working

I have an ASP.NET MVC 4 application that I am trying to host in IIS 7.5. I tried creating a virtual directory using "Use Local IIS Web server" option in Project properties and have set the Anonymous Authentication and Windows Authentication set in IIS.

When I run the application, it opens in the browser with the url, "http://localhost\\ApplicationName" and I am able to view only the tab names I have created. When I right click and view the page source, I have my scripts listed and the body defined with divs and tables. When I click the tab names, nothing happens.

In the view page source, when I click any script, it throws an error,

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Detailed Error Information
Module  IIS Web Core
Notification    MapRequestHandler
Handler StaticFile
Error Code  0x80070002
Requested URL   http://localhost:80/Scripts/Script.js
Physical Path   C:\inetpub\wwwroot\Scripts\Script.js
Logon Method    Anonymous
Logon User  Anonymous

In IIS, I have enabled Anonymous, ASP.NET Impersonation and Windows Authentication.

Also, When I look at the Advanced settings for the directory, it shows the physical path in C\\Users........ but in the Detailed Description, it shows the Physical Path as "C:\\inetpub\\wwwroot\\Scripts\\Script.js".

Am I giving the path wrong? or should I place the project files in "C:\\inetpub\\wwwroot\\Scripts\\Script.js"?

Please help. I have been struggling with this for a while now and it's driving me crazy.

Are you using URL Bundles or are you manually hard coding .JS paths in your front-end code? Are you seeing good/expected behavior when you run the site in debug mode within Visual Studio? I would try and gather some hints with those considerations and perhaps furnish some more information...

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