在Windows Azure上运行WCF服务时,获取“拒绝访问”异常消息

时间:2010-07-08 22:17:42

标签: c# windows wcf azure healthvault

我正在尝试构建一个Healthvault WCF Web服务,该服务需要使用Visual Studio 2010在C#上在Windows Azure上部署x509证书。当我在本地IIS7上调试解决方案时,我可以执行所有功能没有问题。当我部署到Windows Azure并尝试运行我的任何方法时,我收到此错误。

  

服务器在处理请求时遇到错误。异常消息是“访问被拒绝”。请参阅服务器日志以获取更多详异常堆栈跟踪是:

     System.ServiceModel.Dispatcher上System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)的System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object实例,Object []输入,Object []&输出)

System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)的System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)中的.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)

这似乎与Healthvault代码没有任何关系,所以我假设它与WCF服务有关。我无法弄清楚我的本地开发环境和Azure之间的变化。无论如何,这是我的web.config文件

<?xml version="1.0"?>
<configuration>
  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          name="AzureDiagnostics">
          <filter type="" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
 <system.serviceModel>
   <services>
     <service name="myIHM.Healthvault">
       <endpoint address="" binding="webHttpBinding" contract="myIHM.IHealthvault" behaviorConfiguration="webHttp" />
     </service>
   </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="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="true"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="webHttp">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  <appSettings>
    <add key="ApplicationId" value="[my-app-id]"/>
    <add key="ShellUrl" value="https://account.healthvault-ppe.com/"/>
    <add key="HealthServiceUrl" value="https://platform.healthvault-ppe.com/platform/"/>
    <add key="AppCertSubject" value="[my-cert-subject]"/>
  </appSettings>
</configuration>

我环顾四周寻找答案,但我似乎找不到任何与我的情况相关的东西。有没有人有任何建议?感谢。

1 个答案:

答案 0 :(得分:0)

需要注意的一点是,在开发结构中运行时,您拥有的权限比在Cloud结构中具有的权限更多。因此,让事情在开发结构中运行并在云中遇到权限错误并不常见;我知道,这是一场糟糕的事。您可以尝试使用例如获取服务器日志具有免费试用版的Azure诊断管理器(http://www.cerebrata.com/Products/AzureDiagnosticsManager/Default.aspx)。这可能会为您提供有关确切失败的详细信息。