0

我刚刚从 WCF 服务切换到 Windows Azure 云服务。我已将我的代码从我的 WCF 服务复制到云服务中。当我运行网站时,我得到

500内部服务器错误。您要查找的资源有问题,无法显示。

这是我的 Web.config 代码:

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
 <add name="PCSDB" connectionString="Data Source=vlnucbukr8.database.windows.net;Initial Catalog=PCSDB;User ID=ProjectPublicLogin;Password=****" providerName="System.Data.SqlClient" />
 </connectionStrings>
  <configSections>
  </configSections>
  <system.diagnostics>
   <trace>
     <listeners>
      <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"name="AzureDiagnostics">
        <filter type="" />
       </add>
    </listeners>
    </trace>
  </system.diagnostics>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
 <customErrors mode="Off"/>
</system.web>
 <system.serviceModel>
   <services>
     <service name ="WCFServiceWebRole1.AllocationService">
      <endpoint address="" behaviorConfiguration="AllocationBehavior" binding="webHttpBinding" bindingConfiguration="" contract="WCFServiceWebRole1.IAllocationService">
       </endpoint>
      <host>
       <baseAddresses>
         <add baseAddress="http://localhost/allocationservice"/>
        </baseAddresses>
     </host>
    </service>
  </services>
   <behaviors>
     <serviceBehaviors>
       <behavior>
         <serviceDebug includeExceptionDetailInFaults="false"/>
       </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="AllocationBehavior">
          <webHttp/>
        </behavior>
   </endpointBehaviors>
 </behaviors>
   <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
 </system.serviceModel>
 <system.webServer>
   <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true"/>
    <httpErrors>
     <remove statusCode="500" subStatusCode="100" />
      <error statusCode="500" subStatusCode="100" prefixLanguageFilePath="" path="/errors.asp" responseMode="ExecuteURL" />
    </httpErrors>
  </system.webServer>
</configuration>
4

2 回答 2

1

找到了解决办法。。

  <configSections>  </configSections> 

必须是第一个孩子

  <configuration> 

标签

于 2013-06-15T08:58:52.457 回答
0

与其将整个代码从服务复制到云项目,不如在解决方案中添加一个云项目,然后右键单击角色并从解决方案中添加现有角色。

于 2013-06-15T08:23:05.107 回答