【问题标题】:WCF WebRole web.config file errorWCF WebRole web.config 文件错误
【发布时间】:2015-05-25 10:51:42
【问题描述】:

我正在尝试使用 WCF WebRole 在 Azure 云服务上托管 WCF REST 服务。这是我的 web.config 文件:

<?xml version="1.0"?>
<configuration>
  <system.webServer>
    <system.diagnostics>
      <trace>
        <listeners>
          <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
            <filter/>
          </add>
        </listeners>
      </trace>
    </system.diagnostics>
    <!--
      For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

      The following attributes can be set on the <httpRuntime> tag.
        <system.Web>
          <httpRuntime targetFramework="4.5" />
        </system.Web>
    -->
    <system.web>
      <compilation debug="true" targetFramework="4.5"/>
      <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
    </system.web>
    <system.serviceModel>
      <services>
        <service name="WCFServiceWebRole1.Service1" behaviorConfiguration="ServiceBehavior">
          <endpoint address="" binding="webHttpBinding" contract="WCFServiceWebRole1.IService1" behaviorConfiguration="web"/>
        </service>
      </services>
      <behaviors>
        <serviceBehaviors>
          <behavior name="ServiceBehavior">
            <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
            <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
            <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
            <serviceDebug includeExceptionDetailInFaults="false"/>
          </behavior>
        </serviceBehaviors>
        <endpointBehaviors>
          <behavior name="web">
            <webHttp/>
          </behavior>
        </endpointBehaviors>
      </behaviors>
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
    </system.serviceModel>
  </system.webServer>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="MySql.Data" publicKeyToken="C5687FC88969C44D" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-6.9.6.0" newVersion="6.9.6.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

我收到 HTTP 500.19 内部服务器错误。 http://i.stack.imgur.com/HgfgV.png

所以现在如果我想在 IIS 管理器的应用程序池设置中更改目标 .net 框架,我该怎么做?

我是这方面的初学者。非常感谢您的帮助。

【问题讨论】:

    标签: c# wcf azure iis web-config


    【解决方案1】:

    关注these instructions 更改应用程序池的 .NET 框架。如果您不知道您的 Web 应用程序在哪个应用程序池上运行,请关注 these instructions 以查找。

    有一种方法可以自动设置框架。完全披露,我开发了一个工具来做到这一点(查看我的个人资料了解更多信息)。否则,我上面的回答应该对你有用,特别是如果你只需要为一两个应用程序这样做。

    【讨论】:

      猜你喜欢
      • 2015-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多