当我尝试运行我的网站时,我收到以下错误.
该网站托管在Windows 2012 R2上.
配置错误:此配置部分不能在此路径中使用.当该部分被锁定在父级别时会发生这种情况.锁定是默认情况下(overrideModeDefault ="Deny"),或由locationMode ="Deny"或遗留allowOverride ="false"的位置标记显式设置.
错误代码:0x80070021
配置来源:
60: <httpErrors errorMode="Detailed" />
61: <handlers>
62: <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
Run Code Online (Sandbox Code Playgroud)
以下是我所尝试的内容:
在applicationHost文件中,我对以下代码进行了更改:
将部分处理程序,模块,anonymousAuthentication,basicAuthentication等的overrideModeDefault从"Deny"更改为"Allow".
在.Net 3.5和4.5中完成了"HTTP激活".
下面是我的web配置文件处理程序代码:
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<remove name="OPTIONSVerbHandler"/>
<remove name="TRACEVerbHandler"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
Run Code Online (Sandbox Code Playgroud)
安装此路径中功能窗口中的所有功能:Internet信息服务 - >万维网服务 - >应用程序开发功能 - >除了CGI之外的所有功能都已启用.
在功能委托中,ASP之前是Read Only,我已将其更改为Read/Write
使用命令提示符解锁处理程序
但我仍然无法摆脱错误.我的本地实例工作正常.此外,我有一个开发服务器,该网站正在工作,只有在我的生产服务器,我收到此错误.
请帮我找出可能导致此问题的原因.
我目前正在使用Microsoft.Web.Administration(MWA)命名空间,以便调整我们的应用程序以使用新API配置IIS 7.5.我知道所有IIS级别的更改都应该在以下文件中表示(我在Win2K8-R2上):
%WINDIR%\System32\inetsrv\config\applicationHost.config
因此,当我使用该ServerManager对象提交配置更改时,应相应地更新该文件.
添加新的MIME类型(使用MWA编程)后,我没有看到任何更改applicationHost.config file,但我确实在IIS管理器窗口中看到了新的MIME类型,IIS可以正确识别此MIME类型.即使在重新启动操作系统后 - 配置文件也不包含新添加的MIME类型,但IIS管理器窗口会列出它.
因为我的应用程序池被强制为32位(Enable32BitAppOnWin64 = true),我认为相关的配置文件应位于%WINDIR%\SysWOW64\inetsrv\Config,但(如果它存在...) - 它也不会在代码提交更新后更改.
有人可以解释一下吗?我错过了什么(可能会查看错误的文件?)?有人可以对SysWOW64\inetsrv\config目录有所了解吗?
这是我添加MIME类型的代码:
ServerManager manager = new ServerManager();
ConfigurationElementCollection staticContentCollection = manager
.GetApplicationHostConfiguration()
.GetSection("system.webServer/staticContent")
.GetCollection();
//MIMETypes is a string[] array, each object is {FileExt},{MIMETypeStr}
foreach (string pair in MIMETypes)
{
string[] mimeProps = pair.Split(',');
ConfigurationElement mimeTypeEl = staticContentCollection
.Where(a =>
(string)a.Attributes["fileExtension"].Value == mimeProps[0])
.FirstOrDefault();
if (mimeTypeEl != null)
{
staticContentCollection.Remove(mimeTypeEl);
}
ConfigurationElement mimeMapElement =
staticContentCollection.CreateElement("mimeMap");
mimeMapElement["fileExtension"] = mimeProps[0]; …Run Code Online (Sandbox Code Playgroud) 我有一个Visual Studio Web应用程序项目,由于某些原因,将文件从多个项目复制到单独的输出目录.我想将此输出目录用作关联的IIS Express站点的根目录.在IIS Express的applicationhost.config文件中,我可以将关联站点的物理路径设置为正确的目录.我会这样设置:
<site name="MySiteName" id="42">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="c:\my\desired\path" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:63470:localhost" />
</bindings>
</site>
Run Code Online (Sandbox Code Playgroud)
但是,当我重新打开项目时,Visual Studio会覆盖我指定的物理路径,将其还原到项目自己的目录.更糟糕的是,Visual Studio没有表明它已经做到了这一点.以下是<virtualDirectory>Visual Studio混淆后元素的外观:
<virtualDirectory path="/" physicalPath="c:\path\to\project" />
Run Code Online (Sandbox Code Playgroud)
如何防止Visual Studio覆盖此路径?
有没有办法使用Windows命令在IIS 7中重建applicationHost.config文件?或者,如果您可以通过修改此文件来帮助我解决问题,那也没关系.将此文件与其他服务器进行比较时,我注意到在删除站点和几个应用程序池后缺少或不同的非常重要的部分.
我绝不是IIS 7的专家,但我已经使用它7年了.我有信心为新网站配置执行了所有正确的步骤,它仍然给我这个错误,"401.1 "You are not authorized to view this page. You do not have permission to view this directory or page using the credentials that you supplied."
C:\Windows\System32\inetsrv\config\applicationHost.config
Run Code Online (Sandbox Code Playgroud)
这发生在IIS APPPOOL {app pool user}不存在的机器上,所以我们从未使用过此用户,就像我通常在配置权限时那样.然而,我们上周在IIS_IUSRS(在此组中使用IUSR)中添加了适当的权限,并且该网站运行正常.我们正在使用Windows身份验证,并且所有其他身份验证方法都已关闭.没有虚拟目录.我们使用的是.NET 4.0,Classic和32位应用程序(在高级设置下).
我们必须通过在绑定的"C:\ Windows\System32\inetsrv"中执行以下命令来手动更新主机名,因为当VeriSign SSL证书添加到绑定时,IIS会使主机名变灰.
appcmd set site /site.name:"himc" /+bindings.[protocol='https',bindingInformation='*:443:subdomain.domain.com']
Run Code Online (Sandbox Code Playgroud)
缺少"坏"Web服务器上的部分:
<customMetadata>
<key path="LM/W3SVC/INFO">
<property id="4012" dataType="String" userType="1" attributes="Inherit" value="NCSA Common Log File Format,Microsoft IIS Log File Format,W3C Extended Log File Format,ODBC Logging" />
<property id="2120" dataType="MultiSZ" userType="1" attributes="None" value="400,0,,,0
" />
</key> …Run Code Online (Sandbox Code Playgroud) iis-7 windows-server-2008 applicationhost http-status-code-401
我想为使用IIS7.5在ASP.NET4.5上运行的站点启用gzip压缩,但是无法让它压缩.
我在共享主机上,所以我不能直接在IIS中设置它.
的applicationHost.config
我将其更改Deny为Allow(我在此处读到我不应该更改allowDefinition设置:如何在IIS 7中使用appcmd更改allowDefinition节属性?)
<section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Allow" />
Run Code Online (Sandbox Code Playgroud)
我的网站的web.config
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
<dynamicTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="application/x-javascript" enabled="true"/>
<add mimeType="application/javascript; charset=utf-8" enabled="true"/>
<add mimeType="*/*" enabled="false"/>
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true"/>
<add mimeType="message/*" enabled="true"/>
<add mimeType="application/javascript" enabled="true"/>
<add mimeType="application/x-javascript" enabled="true"/>
<add mimeType="application/javascript; charset=utf-8" enabled="true"/>
<add mimeType="*/*" enabled="false"/>
</staticTypes>
</httpCompression>
Run Code Online (Sandbox Code Playgroud)
作为上述的替代,我也尝试将其添加到我的web.config:
<configuration>
<system.webServer>
<urlCompression doStaticCompression="true" doDynamicCompression="false" />
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我在Windows …
当我使用"appcmd list appool/text:*"命令时,它以明文形式显示应用程序池标识密码.我也可以使用PowerShell中的Get-WMIObject以明文形式查看密码.这可能是严重的安全威胁,因为具有正确访问凭据的用户可以轻松查看密码.
IIS(v7.5)中的应用程序池使用域用户帐户/密码进行配置.在applicationHost.config文件中,使用"IISWASOnlyAesProvider"加密提供程序加密密码.但是,当我使用上述两种方法中的任何一种时,密码都会以明文形式显示.
有没有办法以这样的方式加密密码,当我使用上述两种方法时,它们不会以明文显示?
他们无论如何要从 web.config 内部使 httpCompression 工作吗?
我尝试在我的 web.config 中添加它,但它什么也没做:
<httpCompression>
<dynamicTypes>
<clear />
<add mimeType="text/*" enabled="true" />
<add mimeType="application/json" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
<staticTypes>
<clear />
<add mimeType="text/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用CreateApplicationHost为一个简单的 Web 服务器创建一个 Asp.Net 应用程序主机,但是System.IO.FileNotFoundException当它尝试创建我的编组对象的实例时我得到了一个:
host = (MyMarshaller)ApplicationHost.CreateApplicationHost((MyMarshaller), virtualDir, physicalDir);
Run Code Online (Sandbox Code Playgroud)
我相信这个错误是因为它找不到包含类 MyMarshaller 的程序集 - 如果我将此程序集放在 physicalDir 的 bin 目录中,那么一切正常,但是我不想这样做(我也不想或者将我的程序集放在 GAC 中)。
有什么方法可以控制 CreateApplicationHost 在何处查找我的程序集?(请注意,MyMarshaller该类与上述代码行位于同一程序集中)
我有一对 IIS 8 机器,都具有相同的应用程序主机,都具有完全相同的机器密钥。在其中之一上,当我尝试为我的应用程序池 ID 使用自定义帐户时,一切正常。另一方面,当我尝试执行此操作时,我会关闭对话框以输入密码,而将我留在高级设置对话框中。当我关闭它时,我收到一条错误消息,指出“值不在预期范围内”。
我已经尝试了所有我能想到的方法:我已经将应用程序主机从工作机器复制并粘贴到非工作机器。导出和导入的机器密钥。查看了我能想到的每一个配置,然后用锤子敲打它——一切都无济于事。
如果有人知道会发生什么或者我可以采取哪些进一步的步骤来尝试诊断这一点,我将不胜感激。
谢谢!
我们在Microsoft Azure中托管了一个Web服务器.它是Windows Server 2008 R2 Datacenter版本,64位.
对于在此计算机上托管的网站,我需要更改applicationhost.config文件.但是,我最近对IIS所做的更改未显示在配置中.我添加了一个新的应用程序池,并将该特定网站添加到该应用程序池中.我重新启动了网站,文件的"修改日期"已更新,但应用程序池不存在.
现在我正在编辑文件C:\Windows\System32\inetsrv\config,但也有一个C:\Windows\SysWOW64\inetsrv\Config,但后者几个月没有更新.
我看错了文件吗?变更是否立即保存?我是否需要完全重启IIS而不仅仅是相关网站?
applicationhost ×10
asp.net ×4
iis ×3
iis-8 ×3
web-config ×3
iis-7.5 ×2
.net ×1
appcmd ×1
gzip ×1
iis-7 ×1
iis-express ×1
mime-types ×1