在HTTPS上托管的WCF代理服务

时间:2016-02-01 21:38:19

标签: c# wcf wcf-binding wcf-security

我有一个通过HTTPS托管的WCF服务。

我的客户必须使用此服务。 当我创建我的cline tif时,我使用这个构造函数

public MyServiceClient(string endpointConfigurationName, string remoteAddress) : 
    base(endpointConfigurationName, remoteAddress)
{
}

endpointConfigurationName是我的.config绑定配置和 我的客户可以与服务人员交谈

但是如果我使用这个构造函数

public MyServiceClient(Binding binding, EndpointAddress remoteAddress) : 
    base(binding, remoteAddress)
{
}

使用以下设置我的绑定

 BasicHttpBinding binding = new BasicHttpBinding("BasicHttpBinding_IMyService");       

然后,当客户端可以与服务进行通信时,我会收到异常

{System.ServiceModel.FaultException: The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.

Server stack trace: 
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

在[0]处重新抛出异常:     在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)     在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData,Int32 type)

这是我的.config的样子。

<system.serviceModel>
    <bindings>
      <basicHttpBinding>

        <binding name="BasicHttpBinding_IMyService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="52428800" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>      

      </basicHttpBinding>

    </bindings>


    <client>
          <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService" contract="MyContract" name="BasicHttpBinding_IMyService"></endpoint>
    </client>
</system.serviceModel>

有谁可以帮助我理解这里发生的事情?

0 个答案:

没有答案