WCF WebRole web.config文件错误

时间:2015-05-25 10:51:43

标签: c# wcf azure iis web-config

我正在尝试使用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框架,我该怎么做?

我是初学者。非常感谢你的帮助。

1 个答案:

答案 0 :(得分:0)

按照these instructions更改应用程序池的.NET框架。如果您不知道运行Web应用程序的应用程序池,请按these instructions查找。

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