【问题标题】:Getting web.config error when publishing my ASP.Net website发布我的 ASP.Net 网站时出现 web.config 错误
【发布时间】:2016-12-22 08:16:19
【问题描述】:

我正在尝试发布我的第一个 ASP.Net 网站,但是当我尝试访问主页时出现此错误。

无法识别的属性“targetFramework”。注意属性名 区分大小写。

这是它所引用的 web.config 文件的部分:

  <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
  </system.web>

如果您想查看完整的错误页面,这里是网站本身:

http://connellchamberofcommerce.com/

ASP.Net 版本 (4.5.2) 是否应该与我的主机使用的 .Net 版本相匹配?正如我所说,这是我的第一个 ASP.Net 网站,我对这个错误感到很困惑。

【问题讨论】:

  • 显示targetFramework 所在的web.config 部分。通常这个问题与 IIS 应用程序池或框架版本控制有关。

标签: c# asp.net asp.net-mvc web-config


【解决方案1】:

http://connellchamberofcommerce.com/底部的版本信息表明应用池的.net版本是2.0.50727.5491,而在你的web.config文件中它是4.5.2。所以将应用程序池更改为使用 4.0。

【讨论】:

    【解决方案2】:

    您的 web.config 对我来说看起来不错。我的猜测是您在运行站点的 AppPool 中设置了错误的 .NET 版本。

    转到您的 IIS -> 选择所需的 AppPool -> 单击基本设置并相应地更改 .Net 版本。

    【讨论】:

      猜你喜欢
      • 2022-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-23
      • 2018-08-01
      • 2013-12-04
      相关资源
      最近更新 更多