IIS websites inheriting settings from unknown origin - iis

I am dealing with an IIS server that hosts 900+ websites. There are about a dozen that do not contain any web.config file, yet on their settings page > HTTP Redirect section the "redirect requests to this destination" is checked and a URL to one of the hosted websites is present inside the textbox below it. I cannot figure out where the checkbox's true value and the URL is coming from.
Note: If I turn off the checkbox a web.config file is created with the following line:
<httpRedirect enabled="false" />
While this kind of works it is not an ideal solution.

In IIS Manager:
Click on the website
Open "Configuration Editor" under the "Server Components" section
In the "Section" dropdown choose "system.webServer/httpRedirect" (or whichever section that has issues)
In the "From" dropdown choose "ApplicationHost.config"
Set or unset the properties
Click "Apply"
You can now edit the website's web.config file manually or use the above interface.

Related

Export to excel in classic asp stopped working [duplicate]

IIS 7.5 , 2008rc2, classic asp, 500 error msg:
The page cannot be displayed because an internal server error has occurred.
I need to know how to configure IIS to get a more detailed error.
I've tried setting to true all of debugging options in the ASP configuration.
But that didn't work. Can anyone help me?
I have come to the same problem and fixed the same way as Alex K.
So if "Send Errors To Browser" is not working set also this:
Error Pages -> 500 -> Edit Feature Settings -> "Detailed Errors"
Also note that if the content of the error page sent back is quite short and you're using IE, IE will happily ignore the useful content sent back by the server and show you its own generic error page instead. You can turn this off in IE's options, or use a different browser.
If you're on a remote server you can configure your web.config file like so:
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
Double click "ASP" in the site's Home screen in IIS admin, expand "Debugging Properties", enable "Send errors to browser", and click "Apply".
Under "Error Pages" on the home screen select "500", then "Edit feature settings" and select "Detailed Errors".
Note that the same steps apply for IIS 8.0 (Windows Server 2012).
After trying Vaclav's and Alex's answer, I still had to disable "Show friendly HTTP error messages" in IE
TLDR:First determine where in the pipeline you're getting the error from (scroll looking for screenshots of something that resembles your error), make changes to get something new, repeat.
First determine what error message you are actually seeing.
If you are seeing the file located here...
%SystemDrive%\inetpub\custerr<LANGUAGE-TAG>\500.htm
...which generally looks like this:
**...then you know you are seeing the currently configured error page in IIS ** and you do NOT need to change the ASP.net customErrors setting, asp error detail setting, or "show friendly http errors" browser setting.
You may want to look at the above referenced path instead of trusting my screenshot just in case somebody changed it.
"Yes, I see the above described error..."
In this case, you are seeing the setting of <httpErrors> or in IIS Manager it's Error Pages --> Edit Feature Settings. The default for this is errorMode=DetailedLocalOnly at the server node level (as opposed to the site level) which means that while you will see this configured error page while remote, you should be able to log on locally to the server and see the full error which should look something like this:
You should have everything that you need at that point to fix the current error.
"But I don't see the detailed error even browsing on the server"
That leaves a couple of possibilities.
The browser you are using on the server is configured to use a proxy
in its connection settings so it is not being seen as "local".
You're not actually browsing to the site you think you are browsing to - this commonly happens when there's a load balancer involved. Do a ping check to see if dns gives you an IP on the server or somewhere else.
Your site's httpErrors settings is set for "Custom" only. Change it to "DetailedLocalOnly". However, if you have a configuration error, this may not work since the site level httpErrors is also a configuration item. In that case proceed to #4
The default for httpErrors for all sites is set for "Custom". In this case you need to click on the top level server node in IIS Manager (and not a particular site) and change the httpErrors settings there to DetailedLocalOnly. If this is an internal server and you're not worried about divulging sensitive information, you could also set it to "Detailed" which will allow you to see the error from clients other than the server.
You're missing a module on the server like UrlRewrite (this one bites me a lot, and it often gives the generic message regardless of the httpErrors settings).
"Logging on to the server is not an option for me"
Change your site's httpErrors to "Detailed" so you can see it remotely. But if it doesn't work your error might already be a config error, see #3 immediately above. So you might be stuck with #4 or #5 and you're going to need somebody from your server team.
"I'm not seeing the error page described above. I'm seeing something different"
If you see this...
...and you expect to see something like this...
...then you need to change "Send errors to browser" to true in IIS Manager, under Site --> IIS --> ASP --> Debugging Properties
If you see this...
or this...
...you need to disable friendly errors in your browser or use fiddler's webview to look at the actual response vs what your browser chooses to show you.
If you see this...
...then custom errors is working but you don't have a custom error page (of course at this point were talking about .net and not classic asp). You need to change your customErrors tag in your web.config to RemoteOnly to view on the server, or Off to view remotely.
If you see something that is styled like your site, then custom errors is likely On or RemoteOnly and it's displaying the custom page (Views->Shared->Error.cshtml in MVC for example). That said, it is unlikely but possible that somebody changed the pages in IIS for httpErrors so see the first section on that.
In web.config under
<system.webServer>
replace (or add) the line
<httpErrors errorMode="Detailed"></httpErrors>
with
<httpErrors existingResponse="PassThrough" errorMode="Detailed"></httpErrors>
This is because by default IIS7 intercepts HTTP status codes such as 4xx and 5xx generated by applications further up the pipeline.
Next, enable "Send Errors to Browser" under the "ASP" section, and under "Error Pages / Edit Feature Settings", select "Detailed errors".
Also, give Write permissions on the website folder to the IIS_IUSRS builtin group.
try setting the value of the "existingResponse" httpErrors attribute to "PassThrough". Mine was set at "Replace" which was causing the YSOD not to display.
<httpErrors errorMode="Detailed" existingResponse="PassThrough">
One thing nobody's mentioned is as a very quick and temporary fix, you can view the error on the localhost of that web server.
You may also verify that if you changed your main website folder (c:\inetpub\wwwroot) to another folder you must give read permission to the IIS_IUSRS group in the new folder.
Fot people who have tried EVERYTHING and just CANNOT get the error details to show, like me, it's a good idea to check the different levels of configuration. I have a config file on Website level and on Application level (inside the website) check both. Also, as it turned out, I had Detailed Errors disabled on the highest node in IIS (just underneath Start Page, it has the name that is the same as the webservers computername). Check the Error Pages there.
Found it.
http://blogs.iis.net/ksingla/archive/2009/02/16/iis-7-5-updates-to-custom-errors-and-compression.aspx
run cmd as administrator, go to your system32\inetsrv folder and execute:
appcmd.exe set config -section:system.webServer/httpErrors -allowAbsolutePathsWhenDelegated:true
Now I can see detailed asp errors .
If you run the browser in the server and test your url of the project with the local ip you have received all errors of that project without a generally error page(for example 500 error page).
In my case it was permission issue.
Open application folder properties -> Security tab -> Edit -> Add
IIS AppPool\[DefaultAppPool or any other apppool] (if use ApplicationPoolIdentity option)
IUSRS
IIS_IUSRS
Double check the encoding of the asp file you are testing.
For instance if you created a file like below on a Windows Server Core 2019 :
echo "<%# LANGUAGE=Javascript %>" > test.asp
echo "<%Response.Write("test");%>" >> test.asp
Then test.asp will be encoded in Unicode, and requesting it will produce a 500 without any details.
Do a notepad test.asp, then click on "Save As..." and choose "ANSI" encoding to fix it.

Landing page throws 404 error but inside pages works

When I type the URL as www.example.com, it throws the following error message.
404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily
unavailable.
but when I type the URL as www.example.com/index.cfm, it works. Please advise what can be the problem and how can I solve this issue.
When I open the URL www.example.com from the server, it throws different error message.
HTTP Error 404.17 - Not Found The requested content appears to be
script and will not be served by the static file handler.
TechNet has an article on this, what you want to do is add a default document. By default IIS doesn't look for .cfm files as "default" files like index.html, so you have to configure it to do that.
From TechNet:
With the GUI
Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7). For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7).
In Features View, double-click Default Document.
In the Actions pane, click Add.
In the Name box, type the file name that you want to add to the list of default documents and then click OK. This file name will be added to the top of the default document list.
Optionally, select a default document in the list and in the Actions pane, click Move Up or Move Down to change the file's precedence.
Optionally, select a default document in the list, and in the Actions pane, click Remove to remove any file names that you do not want to use as default documents.
With the CLI
To add a file name to the list of default documents, use the following syntax:
appcmd set config /section:defaultDocument /+files.[value=' string ']
The variable string is the file name that you want to add to the list. For example, to add a file named home.html to the default document list, type the following at the command prompt, and then press ENTER:
appcmd set config /section:defaultDocument /+files.[value=' home.html ']
To remove a file named home.html from the default document list, type the following at the command prompt, and then press ENTER:
appcmd set config /section:defaultDocument /-files.[value=' home.html ']
For more information about Appcmd.exe, see Appcmd.exe (IIS 7).

Configure ISAPI redirector: worker propreties for IIS and Liferay

we have fronted Liferay tomcat server with IIS , and we used ISAPI tomcat redirector for that ,everything works just fine.
the problem is that We need to map a specific Domain name to a specific URL on Liferay:
workers.properties :
worker.mydomain_com.port=8014
worker.mydomain_com.host=127.0.0.1
worker.mydomain_com=ajp13
uriworkermap.properties
/mydomain.com/=mydomain_com
/www.mydomain.com=mydomain_com
/www.mydomain.com/*=mydomain_com
This configuration will map www.mydomain.com to localhost:xxxx .
what i want is how to configure the worker mydomain_com so it can be mapped to localhost:xxxx/web/organiation. I searched for worker.mydomain.options but there is no configuration for the uri, is there any way to do ?
Thanks
As your configuration in IIS for mapping to www.mydomain.com is working fine. Its better to keep it like that and enable friendly URL for site in liferay so that you don't really need /web/organiation
Here are the steps to do in liferay 6.1
Login to Liferay as administration.
Go to Control Panel
Select your site and then click on "Site Settings".
Click on "Site URL" in right side.
Under "Virtual Hosts", you should see a text box named "Public Pages"
Enter www.mydomain.com and save.
Then liferay automatically redirect requests coming to it from www.mydomain.com to public pages of this site.
If you are using different liferay version, steps may be little different. But it still provides an option to set domain name for site.

Create user friendly alias for a sharepoint site

I have a test Sharepoint server running on a Windows 7 machine. The url is http://liu-t500-01 and i want to create a user friendly alias http://temp for it. i have added
127.0.0.1 temp
to my hosts file (an A/host entry) and i have also created an alternate access mapping in Central Administration
http://liu-t500-01 Default http://liu-t500-01
http://temp Intranet http://temp
However when i try http://temp in the browser the sharepoint site does not come up. This is probably a simple problem but has me scratching my head...what did i do wrong?
Changing the IIS binding only will cause errors. You need to modify the alternate access mappings in SharePoint. There are tons of good articles our there that tell what to do in detail.
Here is just one: http://technet.microsoft.com/en-us/sharepoint/Video/ff679917
Try adding a host header in IIS
In IIS click on your site
choose the Bindings action
Click Add
In the Host Name field enter "temp"
click OK

File Security (IP address access restrictions) in IIS7

I have a web service that contains 2 asmx files (public.asmx and private.asmx). On IIS6 I could go to the properties of private.asmx then, from the 'File Security' tab, deny all computers access except the IP address for localhost.
In IIS7 I only seem to be able to do this for an entire folder. What am I missing?
Funny - I found this question because I have the same problem, but I think the solution is as follows:
In IIS7, browse to the directory containing your public.asmx and private.asmx files.
The title at the top will reflect the current directory, like "WebService Home". Click the "Content View" button at the bottom.
Right-click on your public.asmx file and choose "Switch to Features View".
The title should be "public.asmx Home" to confirm that you're managing the one file.
Add your IP restrictions. In this case, I think you want an Allow entry for 127.0.0.1 and choose "Edit Feature Settings" from the Action menu to Deny access to unspecified clients.
Click your containing folder again (e.g. WebService) and switch to Content View again to repeat these steps on private.asmx.
I am learning the ropes of IIS7 myself, but I hope this answers your question.
Found this question via Google and was looking for how to do it via the .config file but could not find that answer here. I've since tracked down the info:
The ipSecurity element is used by the web.config in IIS7 to restrict access by IP Address. You can use it like this:
<configuration>
<location path="private.asmx">
<system.webServer>
<security>
<ipSecurity>
<add ipAddress="192.168.100.1" />
<add ipAddress="169.254.0.0" subnetMask="255.255.0.0" />
</ipSecurity>
</security>
</system.webServer>
</location>
</configuration>
Update: Note that the role has to be added for this security to be enabled. See the ipSecurity article linked above.

Resources