in IIS 7 add site specific error page settings - iis-7

I'm trying to setup a classic ASP page to log errors by redirecting the errors to error page that has logging enabled. When the site was migrated from IIS6 to IIS7 the logging stopped working as the details of the errors are not included in the redirect.
I have been able to fix this issues somewhat by going to the site in IIS Manager, going to that sites Error Pages, Clicking Edit Feature Settings, and Changing that option to Detailed errors for local requests, setting my default path to the error page, and changing the path type to execute URL. In order to do this I had to edit the apphost.config and remove some of the locks that are in place there.
Now when I go to other sites on my IIS the same default page path is set on those too. can someone please point me to some documentation or tell me how to make this change only for this particular site?

TO do the error page per Website Deployed in the IIS you need to click on individual website and then on right hand side click on Error Pages and select the Page.

My problem ended up that I was editing my applicationHost.config which would seem like a reasonable solution, but alas it was not. Changing that XML seems to have no effect on what the IIS manager would allow me to do. I finally went into the Configuration Editor for the root of IIS and edited the same settings there, which actually had some effect. All that I had to do at that point was remove the attribute lock on default path and the then I was able to edit my site. I have no idea why changing the application host did not have any effect. I would make the change and when I finally looked in the settings in the IIS manager, nothing I had done was changed at all... FYI this is IIS 7.5 on Win7
Hope this helps someone else.

Related

set Default.html as start page in Web application

I had played down with my host configurations to the point that I can't revert back! I just want to be able to run it from my own visual studio, so I can debug some javascript and don't care if it is not running on Local IIS. I have web application in VS 2013 (Proj1) that I want to add a default.html page to. I set it as the start page, but when running the app, I keep getting the error:
HTTP Error 500.19 - Internal Server Error The requested page cannot be
accessed because the related configuration data for the page is
invalid.
Luckily, this is my own personal machine and I don't mind resetting its IIS or changing its apps configurations. I've tried the following:
I had initially setup my web application via VS as SSL Enabled = true, but now I am trying to reset, so my project properties look like this:
Even though I don't care about IIS setup, I still looked into my C:\Windows\System32\inetsrv\Config\applicationHost.config file, but looked fine
looked at my web.config, but nothing stands out
I think the process of setting up the SSL is the culprit. Is there anywhere else I should look? I just want to be able to run a simple Default.html
I had a problem very similar to this before in the past. This is what I did to solve it.
Try to debug a very basic page with nothing on it (Make sure that works)
Then start building the page back up.
For me it was when I added "Custom Controls" back in, when I removed those controls from the page everything worked.

Can't find the include files for classic asp site

I'm having problems with an old classic asp site that I'm trying to get set up in a dev environment. I get the following error at the line for the include files.
An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error.
Here's my setup:
I'm running IIS 7 on Win 7.
I have an app pool ControlPanel set up with No managed code and classic pipeline
My website ControlPanel configured under default websites pointing to my project directory "C:\Projects\uk_CP\uk_AU\au"
Many of the pages work, I can log in, click on a link to a feedback form, but eventually I get the above error.
My feedback form is located at "C:\Projects\uk_CP\uk_Au\au\feedbackform_admin\dataview_master.asp"
It has two include files:
<!--#include file="../inc/adovbs.inc" -->
<!--#include file="../inc/incCreateConn.asp" -->
this are correctly located in "C:\Projects\uk_CP\uk_Au\au\inc\"
Is perhaps my IIS configured incorrectly that throws off my working directory? Is there a useful way to troubleshoot the path it's looking at? I haven't work in classic asp in 10 years and it is not something I want to become an expert in, but I do need to get this figured out and I've killed too much time as it is.
Obviously this is an issue with my setup since it does work in production...
In your ASP-configuration you must enable the setting 'Allow parent paths'

HTTP Error 403.14 - Forbidden Error when accessing website

So I have all the updated code, the entire solution builds. It works on everyone else's machine, however when I try and access localhost/extranet on my machine, it gives me this error:
HTTP Error 403.14 - Forbidden
Detail Error Info:
Module DirectoryListingModule
Notification ExecuteRequestHandler
Handler 0x00000000
Requested URL http://localhost:80/extranet/
Physical Path C:\svn\K2\trunk\appteam\web\Chatham.Web.UI.Extranet\
Logon Method Anonymous
Logon User Anonymous
Now I tried going into IIS7, and enabling directory browsing, this removed the error, but still didn't bring up my website. I also tried going in and disabling the default document, re-enabling it, everything, nothing worked. I've also restarted IIS a few times to no avail.
Any ideas?
It sounds like your IIS is not processing the routing rules for your application and is trying to find a default.aspx, index.htm, etc. Since it cannot, it is wanting to display the directory listings (which is why you were getting the 404.14).
I just checked my dev setup and I think that your AppPool has to be set on Integrated as opposed to Classic on the Managed Pipeline for the AppPool. I have ran into this before, there may be ways to use the Classic Pipeline, but this would/should be the quickest way to resolve your issue. To check/change the pipeline mode, click on Application Pools from the menu on the left side of IIS, find your AppPool and look in the managed pipeline column. If it is set to Classic -> Right click the AppPool, choose basic settings, then change the dropdown from Classic to Integrated.
If I am incorrect, someone please feel free to correct me on this in the comments.
Edit - Just to add, you can run an MVC app in the Classic Pipeline mode, but you have to do the IIS 6 tricks to get it to work properly. Mainly, you need to turn on wildcard script mapping for MVC to work in Classic mode, If not it expects an .aspx file (or similar) to exist for it to handle the execution pipeline over to .NET from IIS.
Causes this error is removed Global.asax file from your root directory of your site.
To solve this problem add a Global.asax file to your project.
See here: How to add Global.asax file to ASP.NET MVC4 project
In IIS, you need to find out which app pool your application is running from. Just right click the web application under Sites>Manage Web Site>Advanced Settings. The first property should be the app pool.
Now, click Application Pools. You should see a column called "Identity". Add that user to the ACL of the C:\svn\K2\trunk\appteam\web\Chatham.Web.UI.Extranet\ directory. If it just says 'ApplicationPoolIdentity', it can be a little tricky figuring out the user. If it's just running under DefaultAppPool, you can use IIS AppPool\DefaultAppPool.
My solution was because I didn't have ASP.NET installed via "Turn Windows Features on and Off" so it was simple. I figured it out by enabling directory browser and trying to go to my views folder which then gave a more descriptive answer and pretty much said that there was a problem with a module because ASP.NET is not properly installed. It then dawned on my to go and install it.
Change the 'start page' by right click on the page and select 'Set as Start Page' that you want to open first when the web application starts first. This might solve your problem. :)
Also make sure in IIS Application Pool settings that Enabled 32-bit Applications under Advanced Settings is set to FALSE. I spent hours trying to fix this and that was my issue. Windows Server 2012 IIS 8.5
I solved this problem by setting exact .net framework. My website was using v4.0 version of .net.
Workaround to handle the problem:
Open command line as an administrator
Go to directory "C:\Windows\Microsoft.NET\Framework\v4.0.30319"
Execute the following: aspnet_regiis.exe -i
Open IIS and change Pipeline Mode of Your application to Integrated
Hope this helps
In my case the HTTP Redirection feature was missing on the server (with IIS 10).
Adding the feature resolved the issue and the site started to load fine.

IIS 7 - Static Content Attempting Authentication

I have a WebForms application hosted in IIS 7. When I run the site from Visual Studio 2010, my static content all loads perfectly. We have the same site hosted in another production environment and the site works great there also.
However, when I am trying to host the site in a new production environment, it is giving me a status code of 302 Found whenever it attempts to load the static content.
When I open up Chrome's Developer Console and look at the network, it shows this:
/login.aspx?ReturnUrl=%2fjs%2fjquery.js
This leads me to believe that something in IIS7 is forcing authentication to occur on static content. Is there anything I should check to see what the likely cause of this problem is?
Ok, for whatever reason, I had to add the IUSR user and give it access to Read on my web apps. I am not sure what changed that made this a requirement. If anyone knows, please feel free to add comments.
If you set the same permissions as for wwwroot folder the problem disappears:
Users and IIS_IUSRS - read access

Forcing custom 404 pages for pages in URL Routing

Coding Platform ASP.NET 4.0 WebForms on IIS7.5
If I request a page blahblah.aspx which does not exist, I get navigated to my custom error page for Page not found Exception. I have implemented URL routing and so I have omitted all my .aspx extensions for routes.
Now, If I type www.mysite.com/blahblah (thats a url without extension) instead of going to my custom error page, it gets redirected to my IIS 404 error page.
What should I do to make my custom error page appear on my site instead of IIS error page?
The Easy Way
If your IIS 7 web server doesn't already have it, install the IIS 7.0 Administration Pack from Microsoft.
Navigate to the root web server name in IIS, and open the Configuration Editor (part of the Administration Pack). Change the dropdown to system.webServer/httpErrors, right-click on defaultPath, and choose 'defaultPath' Attribute -> Unlock Attribute.
Then try to change the custom error handler page again. Navigate to your site, open Error Pages under the IIS group, click Edit Feature Settings on the right, select Custom error pages and finally, put in your path for the default page.
No lock error this time.
I originally tried to unlock this attribute at the web site level but was prevented, so be aware you may have to go all the way to the root of the IIS tree, the web server itself.
The Manual Way
I know you can accomplish all this by direct editing in notepad of the appropriate config file on the web server. And that may be required for your particular web hosting environment or company production web server change protocols. But why make it complicated if it doesn't need to be? Plus, this way you can do it in the GUI, and compare the before and after to see what changes you truly have to make. But if you MUST do it manually, then:
Open the file %windir%\System32\inetsrv\config\applicationHost.config in Notepad. Run Notepad as administrator if you're having problems.
Pro tip: Do not use notepad++ to edit applicationHost.config. You'll end up secretly and silently saving a 32-bit copy of the file that's in a different folder than the one IIS looks in (due to Windows, not np++) without actually affecting the file you wish to change.
You'll see something like this:
<httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
Remove the ,defaultPath section and save.
You will be able to make the changes you need.
Assuming you haven't done this already...
Go to IIS, select your website, and choose the option "Error Pages". In there, find the 404 status code, right click and go to "Edit Feature Settings". you can then select "Custom Error pages" and change the "Path Type" to URL "Execute URL" to do some rewriting, or a default redirect page for anything else. Put in your URL as a relative value, and now it should redirect to this url on 404 errors.
Edit: Did a bit of digging, in cases, this config may be locked, if you run the following command, it should remove the lock:
%windir%\System32\inetsrv\appcmd unlock config -section:system.webserver/httperrors
Once that is done, you can edit the url properly.

Resources