如何在Iis服务器上将Web配置文件更改为主机 [英] How Do I Change Web Config File To Host On Iis Server
本文介绍了如何在Iis服务器上将Web配置文件更改为主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在iis7.5上托管我的网站时我收到以下错误
无法识别的属性'targetFramework'。请注意,属性名称区分大小写
at line
< compilation debug =truetargetframework =4.0>
我的网络配置文件包含
while hosting my website on iis7.5 i am getting following error
Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive
at line
<compilation debug="true" targetframework="4.0">
my web config file contains
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<connectionStrings>
<add name="dbconn" connectionString="Dsn=recruitment;uid=sa" providerName="System.Data.Odbc" />
</connectionStrings>
<system.web>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
</httpHandlers>
<compilation debug="true" targetFramework="4.0">
<buildProviders>
</buildProviders>
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies></compilation>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
推荐答案
当您拥有属性时,通常会发生这种情况web.config中的targetFramework =4.0但应用程序池设置为运行ASP.NET 2.0。 ASP.NET 2.0完全无法识别targetFramework属性 - 因此将其更改为2.0将无法达到预期的效果。
This typically happens when you have an attribute of targetFramework="4.0" in the web.config but the App Pool is set to run ASP.NET 2.0. The targetFramework attribute is entirely unrecognized by ASP.NET 2.0 - so changing it to 2.0 won't have the desired effect.
这篇关于如何在Iis服务器上将Web配置文件更改为主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文