MVC5 IIS7.5 Win7 routes return 404 - iis-7.5

I have been searching for a solution and have had no luck. I have seen plenty of questions on here where it is suggested to install KB980368, however I have the extensionless handlers in IIS so it did not need to install. I tried <modules runAllManagedModulesForAllRequests="true"> and no luck so then I tried <modules">
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules> and still no luck. I have my app pool running 4.0 integrated and am at a loss. All of the controllers/views follow the default route mapping yet no matter what I do I get a 404 not found on every view other than my default Home.
This is running on Win7 IIS 7.5 all updates applied. Deploying the same code to Server 2012 R2 IIS all the routes work and everything works.

Well after more head banging on the desk I found the issue is a virtual path in SSRS. This virtual path conflicts with the name of a view folder and it appears SSRS is intercepting the call. Disable SSRS service and now I get a 503. I updated my views and controller and now all works. What a shitty job of MS notifying you that SSRS is stealing the traffic before it even hits IIS.

Related

How do I deploy Blazor WebAssembly Core Hosted Self-Contained App to IIS [duplicate]

This question already has an answer here:
asp.net core web api published in IIS after moved to different IIS server pc gives error 500.19 (0x8007000d)
(1 answer)
Closed 2 years ago.
I have developed a Blazor WebAssembly App that will be used on a Server running Windows 2012 on our Intranet. This is targeting .Net 5.0 Core Hosted and Self-Contained. I need to deploy to IIS 8.5 and have some questions.
When I add the website in IIS, do I point to the root deploy directory with the executable and web.config?
Is there anything else I need to do so that IIS will find the index file in the wwwroot sub-directory?
Is is appropriate to put the deploy directory for this app directly under inetpub?
The publish task created a rather large BlaorDebugProxy directory. This is for release so I don't understand why this was created. Is there a way to prevent this from happening?
I want to access the app using ServerName\AppName. If I create the site with 'AppName' for the host name, will that work or is there something else I need to do?
When I try to browse to the site from IIS, I get a 500.19 'The requested page cannot be accessed because the related configuration data for the page is invalid.' I have not made changes to the file as it was created by the publish process. It is:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\AppName.Server.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 60862cf1-bea8-48f4-8ae9-270f2f537927-->
Any ideas why this is not working?
PLEASE NOTE that this is using the SELF-CONTAINED model.
Also, I have made sure that the directory has granted full permissions to the App Pool Identity for this App.
The answer below and the supposed duplicate all refer to installing the framework. However, I thought that the whole point of the self-contained model is that it does not rely on an installed framework.
I have searched extensively and see many references that touch on these issues but nothing that says specifically how to get IIS (especially an older version) to host the self-contained model. The Microsoft pages talk about advantages and disadvantages and how to create the files but no details about how to host them or the other questions I listed above.
Has anyone done this successfully who can provide some guidance?
Thanks !
Firstly, please ensure that the Asp.net Core IIS Hosting Bundle installer has been installed on the server.
https://dotnet.microsoft.com/download/dotnet/5.0
Besides, the identity under where your web application runs in IIS should have full access to the root folder of your website. Try to grant the IUSR account full control to that physical path.
Last, please refer to the below link to hosting Core-based web application in IIS.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1
Feel free to let me know if the problem still exists.

How do I make Application Warm Up Work on Server 2008 R2 - IIS 7.5?

I have searched through dozens of posts (most of them are a few years old). I would like to speed up the first load of our app and have not found the correct configuration combination to do so on Server 2008 R2. I have it working well on Server 2012 R2 - IIS 8.5. But we still have some sites on Server 2008 R2. What I have done for Server 2008 R2 is:
Installed 'Application Initialization 1.0 for IIS 7.5' and rebooted
Edited applicationHost.config under applicationPools to add:
'startMode="AlwaysRunning"'
Edited applicationHost.config under sites to add 'preloadEnabled="true"' to application path
Edited my application's web.config file to add 'applicationInitialization doAppInitAfterRestart="true"' under system.WebServer
This seemingly has no effect. What am I missing? FWIW, I am using ApplicationPoolIdentity and have Anonymous & Forms Authentication Enabled and ASP.NET Impersonation, Basic, & Windows Authentication Disabled. Any hints are greatly appreciated. Thanks.
After point 2 I would do the following:
Go to your Server in IIS, then double-click on ConfigurationEditor, then Choose:
1-system.applicationHost/applicationPools->Click on (Collection)-> Choose your Pool->Check if "autoStart" is "true" and validate that startMode is "AlwaysRunning"(already done on your point 2)->Then Close the window->Click on apply
2-system.applicationHost/sites->Click on (Collection)->Now Click on the site you want and turn serviceAutoStart to "true",if your site is inside "Default Web Site" press (Collection) below->Now choose your site->Turn preloadEnabled to "true" and serviceAutoStartEnabled to "true" as well.-> close all and apply.
To test go to your pool restarted it in IIS and check in your task manager that w3wp.exe is using your CPU.After some seconds w3wp.exe will stop using your CPU.
For those like me looking for an answer years after all documentation seems to have been wiped from the internet, this worked for me.
Download and install Application Initialization Module for IIS 7.5 from one of the following links (requires reboot): Link 1 Link 2 Link 3
Edit C:\Windows\System32\inetsrv\config\applicationHost.config
Find the configuration\system.applicationHost\applicationPools configuration section
Add autoStart="true" to the application pool used by your web app, so this
<add name="MyCoolAppPool" startMode="AlwaysRunning" enable32BitAppOnWin64="true" managedRuntimeVersion="v4.0" />
becomes this:
<add name="MyCoolAppPool" autoStart="true" startMode="AlwaysRunning" enable32BitAppOnWin64="true" managedRuntimeVersion="v4.0" />
Find the configuration\system.applicationHost\sites\site configuration section
Find the application node for your web app
Add preloadEnabled="true" so the node changes from this
<application path="/UrlPathToMyApp" applicationPool="MyCoolAppPool">
<virtualDirectory path="/" physicalPath="C:\Virtual Directories\MyCoolApp" />
</application>
to this
<application path="/UrlPathToMyApp" preloadEnabled="true" applicationPool="MyCoolAppPool">
<virtualDirectory path="/" physicalPath="C:\Virtual Directories\MyCoolApp" />
</application>
Finally, restart IIS.
Rick Strahl explained a hiccup he had to deal with when installing/configuring it: Add AppWarmupModule to <globalModules> like this:
<globalModules>
<add name="AppWarmupModule" image="%SystemRoot%\system32\inetsrv\warmup.dll" />
</globalModules>

How to configure Glimpse to work with virtual directories?

My application has a virtual directory that points to a shared folder of images on a remote file server. When trying to access the images via the browser (like http://webserver/app/VD-alias/image.png) I get a "configuration error":
An error occurred loading a configuration file: Failed to start monitoring changes to '\\fileserver\sharedfolder\web.config'.
After a lot of investigating I suspect this is a security issue. However:
The AppPool uses Integrated pipeline identity is NETWORK SERVICE.
The file server only allows user domain access not machine account access (which is what the web server would use for this AppPool identity).
But in IIS, the virtual directory is configured to use specific domain account credentials to access the shared folder, so everything should be fine regarding access.
After a lot of investigation I realized that this had to do with the Glimpse defaultRuntimePolicy being On. When I turn it off, everything works fine. At the moment this is my Glimpse settings in web.config:
<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
<runtimePolicies>
<ignoredTypes>
<add type="Glimpse.AspNet.Policy.LocalPolicy, Glimpse.AspNet" />
</ignoredTypes>
</runtimePolicies>
</glimpse>
So I'm wondering if Glimpse is not using the virtual directory credentials set by IIS? Or what else could Glimpse be doing differently that would prevent access to the images?
In any case, I was wondering if there was a way to prevent glimpse from interfering with that specific path or with images in general?
I've tried using:
<uris>
<add regex=".*uploads.*" />
</uris>
and
<uris>
<add regex=".*/.*\.png" />
</uris>
and
<contentTypes>
<add contentType="image/png" />
</contentTypes>
I've also tried changing the runAllManagedModulesForAllRequests. I've tried different IIS versions and the latest Glimpse version.
But none of them seem to make any difference except when I turn off Glimpse.
Has anyone faced this issue? I'm pretty sure it's reproduceable. How can I get Glimpse and my virtual directory to play nice?
Thanks in advance.

Visiting an Azure Website while Publishing displays IIS Errors

I have an MVC app hosted on an Azure Website.
I have custom errors enabled and working (when not publishing):
<customErrors mode="On" defaultRedirect="~/Error/NotFound" xdt:Transform="Replace">
<error redirect="~/Error/NotFound" statusCode="404" />
<error redirect="~/Error/NotFound" statusCode="403" />
</customErrors>
When I publish the website from Visual Studio, if I try to visit the site while the dlls are being updated, I get a nasty IIS error.
I'm surprised that Azure doesn't wait to "tie down" the new version until the publication is complete, to avoid this scenario. Is there a way to achieve this "instantaneous switch" behavior?
And/Or - How can I prevent this error from being displayed?
I can't say this would be unusual. Depending on size of the deployment it may take a while for IIS to restart and reload leading to 503 Service Unavailable or similar errors in the meantime. CustomErrors won't help you here as the ASP.Net pipeline isn't even being reached at this point. What Azure Website level are you running on (Free, Shared or Standard?) If you can up the size of the instance to try and get things moving again more quickly.
I think you deployment is too slow. IIS detects changes in dll files and restart the app-pool automatically without waiting for the other dll files.
Try to set custom values in waitChangeNotification and maxWaitChangeNotification in web.config. Doing so you can ask IIS to wait for some seconds before restarting app-pool. I'm not sure if it works on Azure. On my on-premises IIS I use custom values that allow me to do a long deploy (about 5 seconds).
Documentation: http://msdn.microsoft.com/en-us/library/e1f13641(v=vs.85).aspx

Problems Deploying web application to iis

Built a web application with webmatrix, try to deploy locally to iis 5.1 for testing purposes so i added it to my wwwroot folder didnt work then i created a virtual directory. the home page works with this but my login created with web helper doesnt work...when i click login all i see is the browser sending login? and nothing happens....and my web deploy that i installed doesnt work either so i can deploy the site with dependencies to iis... also can it be deployed to windows server2003....any hints would be appreciated...
.
I am using Webmatrix3 and my web server is Windows Server 2008 R2 with IIS7. I just copy and paste my entire project directory from my local machine up to the IIS inetpub/wwroot directory. Then from within IIS7 I right click that directory (which is now in the tree under sites) and select "Convert to Application". Works every time.
I also had to add this to my Web.config to make it work in I.E. because of the forced compatibility mode issue:
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
</system.webServer>
I hope this helps!

Resources