托管时MVC站点错误

时间:2017-10-07 15:50:50

标签: asp.net model-view-controller web-config hosting

我在尝试将我的网站托管到互联网时有下面附加的图像文件。它由ASP.net mvc开发,webconfig.file就像这样;

{

<configuration>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>

  <system.web>
    <customErrors mode="Off"></customErrors>
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
    </httpModules>
  </system.web>
  <system.webServer>
    <security>
      <requestFiltering allowDoubleEscaping="true"/>
    </security>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <!--alt satırı ekledim-->
      <remove name="UrlRoutingHandler"/> 
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <validation validateIntegratedModeConfiguration="false" />
    <!--alt satırı ekledim-->
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ApplicationInsightsWebTracking" />
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
    </modules>
  </system.webServer>

}

我该怎么办才能完成托管?

Site error while hosting

1 个答案:

答案 0 :(得分:0)

我希望这个问题出现在应用程序的可信级别。我相信你的web.configuration缺少可信级别配置,为此,我们可以添加几行代码

您必须在web.config文件中的<trust level="Full"/>元素下添加<system.web>。我希望这些能帮到你。