获取“访问被拒绝”;在 Windows Azure 上运行 WCF 服务时出现异常消息
我正在尝试使用 Visual Studio 2010 构建一个 Healthvault WCF Web 服务,该服务需要 x509 证书才能在 C# 中部署在 Windows Azure 上。当我在本地 IIS7 上调试解决方案时,我可以毫无问题地执行所有功能。当我部署到 Windows Azure 并尝试运行我的任何方法时,我收到此错误。
服务器在处理请求时遇到错误。异常消息是“访问被拒绝”。有关更多详细信息,请参阅服务器日志。异常堆栈跟踪是:
在System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(对象实例,对象[]输入,对象[]和输出)在System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc和rpc)在System.ServiceModel.Dispatcher .ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) 在 System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) 在 System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
这似乎没有什么与 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>
我四处寻找一些答案,但我似乎找不到任何适合我的情况的内容。有人有什么建议吗?谢谢。
I am trying to build a Healthvault WCF web service that requires an x509 certificate to deploy on Windows Azure in C# using Visual Studio 2010. When I debug the solution on my local IIS7, I can perform all functions no problem. When I deploy to Windows Azure and try to run any of my methods, I get this error.
The server encountered an error processing the request. The exception message is 'Access is denied.'. See server logs for more details. The exception stack trace is:
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
This doesn't seem to have anything to do with the Healthvault code, so I'm assuming that it's related to the WCF service. What I can't figure out is what changes between my local dev environment and Azure. Regardless, here is my web.config file
<?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>
I've looked around for some answers but I can't seem to find anything that pertains to my situation. Does anyone have any recommendations? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
需要注意的一件事是,在开发结构中运行时,您比在云结构中运行时拥有更多的权限。因此,在开发结构中工作然后在云中遇到权限错误的情况并不少见;我知道,这真是太糟糕了。您可以尝试使用 Azure 诊断管理器 (http://www. cerebrata.com/Products/AzureDiagnosticsManager/Default.aspx),有免费试用版。这可能会为您提供有关失败原因的更多详细信息。
One thing to be aware of is that you have more permissions when running in development fabric than you do in Cloud fabric. SO it's not too uncommon to have things work in development fabric and then run into permission errors in the Cloud; a bummer, I know. You can try to get the server logs using e.g. Azure Diagnostics Manager (http://www.cerebrata.com/Products/AzureDiagnosticsManager/Default.aspx) which has a free trial. That might provide you with more details on exactly what is failing.