动态托管时如何更改端点绑定类型?

时间:2017-02-02 08:54:37

标签: c# asp.net web-services wcf

我有2个web.config。其中一个在客户端内部,另一个在服务器内部。

如果我从客户那里拨打电话。发生以下错误: mscorlib.dll中出现“System.ServiceModel.ProtocolException”类型的异常,但未在用户代码中处理

其他信息:内容类型application / soap + xml;服务http://localhost:55876/ServiceWithoutSVC/WelcomeService.svc?wsdl不支持charset = utf-8。客户端和服务绑定可能不匹配。

我GUESS客户端有wsHttpBinding但是服务器BASICHTTPBINDING。如何在服务器web配置中将相对存取绑定更改为wshttpbinding?

enter image description here

客户端Web配置:

    

  <wsHttpBinding>
    <binding name="MyBinding" allowCookies="true"  maxReceivedMessageSize="20000000" maxBufferPoolSize="20000000">
      <readerQuotas maxDepth="32" maxArrayLength="200000000" maxStringContentLength="200000000"/>
    </binding>
  </wsHttpBinding>
</bindings>
<client>
  <endpoint name="BookService"
              address="http://localhost:55876/ServiceWithoutSVC/WelcomeService.svc?wsdl"
              binding="wsHttpBinding"
              contract="IsoletedClient.Services.IWelcomeService" bindingConfiguration="MyBinding" />

</client>

server web.config:

            

<serviceHostingEnvironment>
  <serviceActivations>
    <add factory="System.ServiceModel.Activation.ServiceHostFactory"
   relativeAddress="./ServiceWithoutSVC/WelcomeService.svc"
    service="ServiceWithoutSVC.WelcomeService" />
  </serviceActivations>
</serviceHostingEnvironment>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

0 个答案:

没有答案