I have a Windows Server 2012R2 running IIS version 8.5.9
Currently it has a single ASP.net Forms web application running on the default http port 80.
The website has an application pool (v4.0 Classic).
The website files are stored in c:\inetpub\wwwroot\formsApp
.
( The application can be accessed in a way similar to: http://server-host-name.company.com
)
This works fine, with no issues.
I created a new ASP.Net MVC application and published it to c:\inetpub\wwwroot\mvcApp
.
I also created a dedicated pool (v4.0 Integrated) and configured it to run on port 8080.
The application works perfectly when I visit: http://server-host-name.company.com:8080
.
Now, I created a virtual folder in the formsApp
website in IIS and pointed it at mvcApp
folder.
I also made sure that the pool used for the virtual folder is the Integrated pool, not the classic. The virtual folder name is mvc
.
I could tell that IIS did something special to that folder, since its thumbnail icon is no longer a normal folder, but an application website thumbnail.
Now when I go to http://server-host-name.company.com/mvc
I can see the page being loaded and the correct controller is called, the view is rendered, but the static script and CSS files are not loaded. When I examined the network log in the browser, I noticed that any request to the script or CSS static content is redirected to the Login Page, since the MVC app has Forms Authentication.
I have looked everywhere how to resolve this issue. Some answers pointed out that I should add a line in Web.config
to add the line
<modules runAllManagedModulesForAllRequests="false" />
But that did not work. it had no effect, as the same page loaded without CSS or JS. But besides the fact that it worked or not, it does not explain why the app worked fine when IIS served it off of port 8080, without having that line included in Web.config.
Edit: Just to clarify, after the app runs from the virtual directory, the links/urls to the static files are valid with the name mvc
prepended to them as expected.
How can I resolve this issue?