500 - 内部服务器错误,Windows Azure云服务

时间:2013-06-15 07:34:22

标签: c# web-services azure deployment azure-storage

我刚从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>

2 个答案:

答案 0 :(得分:1)

找到解决方案..

  <configSections>  </configSections> 

必须是

的第一个孩子
  <configuration> 

标签

答案 1 :(得分:0)

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