Is it possible to change IIS settings from web config
I'm using url rewriting.net. I'm testing web on the local host, it is successfully work. But When i deploying web to remote host, url rewriting not work. Problem is (The resource cannot be found). I found problem. My deployed remote host IIS configuration is (Virtual dir->Properties->Home directory->Application Mapping->.aspx->Edit->"Check that file exist" is checked). I need to uncheck them. But my deployed host control panel not have a application mapping function.
开发者_运维知识库How to uncheck this option using web.config?
Is it possible?
Has you another idea?
IIS6
If this is IIS6 then unfortunately there is no way to change the script map settings via your ASP.NET web.config
file.
You would need to find a hoster that permitted this configuration change via their control panel, or ask your present hoster (nicely) to change this for you.
IIS7
If this is IIS7 then you need to add (if it doesn't already exist) a <system.webServer />
configuration section to your web.config
file and modify the handler behaviour:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<!-- remove existing handlers -->
<remove name="PageHandlerFactory-ISAPI-2.0" />
<remove name="PageHandlerFactory-Integrated" />
<!-- add back but set resourceType="Unspecified" to prevent
checking if file exists -->
<add name="PageHandlerFactory-ISAPI-2.0"
resourceType="Unspecified"
path="*.aspx"
verb="GET,HEAD,POST,DEBUG"
modules="IsapiModule"
scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
requireAccess="Script"
preCondition="classicMode,runtimeVersionv2.0,bitness32"
responseBufferLimit="0" />
<add name="PageHandlerFactory-Integrated"
resourceType="Unspecified"
path="*.aspx"
verb="GET,HEAD,POST,DEBUG"
type="System.Web.UI.PageHandlerFactory"
preCondition="integratedMode" />
</handlers>
</system.webServer>
</configuration>
This will only work if your hoster has delegated read/write access to the Handler Mappings feature.
I'd be fairly surprised though if this was IIS 7 and the PageHandlerFactory-ISAPI-2.0
and PageHandlerFactory-Integrated
handler were configured as resourceType="File"
or resourceType="Either"
. Out of the box they're configured not to check for the existence of files and folders.
精彩评论