一大波問題解決和配置備份 WCF快煉成精了

jodies發表於2015-03-06

1. 首先我的Service工程配置,target一定要也設成x64

2. 其次

因為WCF出現了“格式化程式嘗試對訊息反序列化時引發異常”(需要加<readerQuotas...),"超過最大配額,使用maxReceivedMessageSize...","超時",的問題,改了最大的接收與傳送的配置.最後這麼配置成功了。

服務端:

<system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding maxBufferPoolSize="2147483647"
                    maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647"
                    maxStringContentLength="2147483647"
                    maxArrayLength="2147483647"
                    maxBytesPerRead="2147483647"
                    maxNameTableCharCount="2147483647"/>
          <security mode="Message">
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="DeepIEHostBehavior" name="DeepIEHostEnTextSegmentation.TextSegmentationService">
        <endpoint address="" binding="wsHttpBinding" contract="DeepIEHostEnTextSegmentation.ITextSegmentationService">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:9806/DeepIE/service" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DeepIEHostBehavior">
          <serviceMetadata httpGetEnabled="True" />
          <serviceDebug includeExceptionDetailInFaults="True" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

客戶端:


  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_ITextSegmentationService" 
                 closeTimeout="00:01:00"
                 openTimeout="00:01:00"
                 receiveTimeout="00:10:00"
                 sendTimeout="00:05:00"
                 maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:9806/DeepIE/service" binding="wsHttpBinding"
        bindingConfiguration="WSHttpBinding_ITextSegmentationService"
        contract="EnglishTextSegmentation.ITextSegmentationService"
        name="WSHttpBinding_ITextSegmentationService">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>


3. 還有,CLR 無法從 COM 上下文 0x20a6f0 轉換為 COM 上下文 0x20a860,這種狀態已持續 60 秒,

解決方法是 在Debug -> Exceptions -> Managed Debug Assistants裡 去掉ContextSwitchDeadlock一項前面的鉤。

在除錯(選單)-->異常--> Managed Debug Assistants裡 去掉ContextSwitchDeadlock一項前面的鉤。


至此一堆蛋疼問題全部解決。




相關文章