我遇到一个问题,我无法在生产环境中使用SSRS Web服务,但它可以在我的本地开发环境和测试环境中运行。唯一的区别是生产环境将Web服务安装在不同的服务器上,即我们的生产数据库服务器。但是,在生产Web服务器上的浏览器中键入Web服务URL会正确提示输入凭据,然后在提供正确的凭据时加载Web服务XML定义。
我得到的例外情况如下所示。
System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass5`1.<CreateGenericTask>b__4(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
我的web.config中有以下XML用于访问SSRS Web服务。
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ReportingService2010Soap" sendTimeout="00:05:00" maxReceivedMessageSize="5242880">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" proxyCredentialType="Windows" realm="54.252.119.210"/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://xxx/ReportServer/ReportService2010.asmx" binding="basicHttpBinding" bindingConfiguration="ReportingService2010Soap" contract="ReportServer.ReportingService2010Soap" name="ReportingService2010Soap"/>
<endpoint address="http://xxx/ReportServer/ReportExecution2005.asmx" binding="basicHttpBinding" bindingConfiguration="ReportingService2010Soap" contract="ReportExecutionServer.ReportExecutionServiceSoap" name="ReportExecutionServiceSoap"/>
</client>
</system.serviceModel>
我怀疑这个问题与生产数据库服务器的配置方式有关,但我不知道这可能是什么。
答案 0 :(得分:0)
原来问题是报告服务Web服务没有配置为使用基本身份验证。
SSRS身份验证配置:http://technet.microsoft.com/en-us/library/bb283249(v=sql.105).aspx
SSRS基本身份验证配置:http://technet.microsoft.com/en-us/library/cc281309(v=sql.105).aspx