客户端调用:
GBIMSG.MSGClient msgClient = new GBIMSG.MSGClient(); try { msgClient.Open(); if (msgClient.sentMSG(sentTo, sentContent, sentContentID, fromSys) == "success") { msgClient.Close(); return "yes"; } else { msgClient.Close(); return "no"; } } catch (Exception ex) { msgClient.Close(); return "no"; }
客户端 webconfig
1 <system.serviceModel> 2 <bindings> 3 <basicHttpBinding> 4 <binding name="BasicHttpBinding_IMSG" closeTimeout="00:10:00" 5 openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 6 allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 7 maxBufferSize="2147483646" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646" 8 messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 9 useDefaultWebProxy="true"> 10 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 11 maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 12 <security mode="None"> 13 <transport clientCredentialType="None" proxyCredentialType="None" 14 realm="" /> 15 <message clientCredentialType="UserName" algorithmSuite="Default" /> 16 </security> 17 </binding> 18 </basicHttpBinding> 19 <wsHttpBinding> 20 <binding name="WSHttpBinding_IMSG" closeTimeout="00:01:00" openTimeout="00:01:00" 21 receiveTimeout="00:01:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" 22 transactionFlow="false" hostNameComparisonMode="StrongWildcard" 23 maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646" 24 messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 25 allowCookies="false"> 26 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 27 maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 28 <reliableSession ordered="true" inactivityTimeout="00:10:00" 29 enabled="false" /> 30 <security mode="None"> 31 <transport clientCredentialType="Windows" proxyCredentialType="None" 32 realm="" /> 33 <message clientCredentialType="Windows" negotiateServiceCredential="true" 34 establishSecurityContext="true" /> 35 </security> 36 </binding> 37 </wsHttpBinding> 38 </bindings> 39 <client> 40 <endpoint address="http://xxxxxxxxxx/GBISMSWCFService/Service.svc" 41 binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMSG" 42 contract="GBIMSG.IMSG" name="WSHttpBinding_IMSG"> 43 <identity> 44 <dns value="61.152.104.183" /> 45 </identity> 46 </endpoint> 47 </client> 48 </system.serviceModel>
wcf 服务端:
1 <system.serviceModel> 2 <services> 3 <service behaviorConfiguration="ServiceBehavior" name="SMSWCF.MSGService"> 4 <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMSG" contract="SMSWCF.IMSG"> 5 <identity> 6 <dns value="localhost" /> 7 </identity> 8 </endpoint> 9 <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 10 <endpoint address="basic" binding="basicHttpBinding" contract="SMSWCF.IMSG" /> 11 </service> 12 </services> 13 <bindings> 14 <wsHttpBinding> 15 <binding name="WSHttpBinding_IMSG" 16 maxBufferPoolSize="12000000" maxReceivedMessageSize="12000000" useDefaultWebProxy="false"> 17 <readerQuotas maxStringContentLength="12000000" maxArrayLength="12000000"/> 18 <security mode="None"/> 19 </binding> 20 </wsHttpBinding> 21 </bindings> 22 <behaviors> 23 <serviceBehaviors> 24 <behavior name="ServiceBehavior"> 25 <!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点 --> 26 <serviceMetadata httpGetEnabled="true"/> 27 <!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息--> 28 <serviceDebug includeExceptionDetailInFaults="false"/> 29 30 <serviceTimeouts transactionTimeout="00:01:00"/> 31 <serviceThrottling maxConcurrentCalls="1000" maxConcurrentInstances="1000" maxConcurrentSessions="1000"/> 32 </behavior> 33 </serviceBehaviors> 34 </behaviors> 35 </system.serviceModel>
wcf:
<system.serviceModel> <services> <service behaviorConfiguration="GBISMSWCF.Service1Behavior" name="SMSWCF.MSGService"> <endpoint address="" binding="wsHttpBinding" contract="SMSWCF.IMSG"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:8731/Design_Time_Addresses/GBISMSWCF/Service1/" /> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="GBISMSWCF.Service1Behavior"> <!-- 为避免泄漏元数据信息, 请在部署前将以下值设置为 false 并删除上面的元数据终结点 --> <serviceMetadata httpGetEnabled="True"/> <!-- 要接收故障异常详细信息以进行调试, 请将下值设置为 true。在部署前 设置为 false 以避免泄漏异常信息--> <serviceDebug includeExceptionDetailInFaults="False" /> <serviceTimeouts transactionTimeout="00:01:00"/> <serviceThrottling maxConcurrentCalls="1000" maxConcurrentInstances="1000" maxConcurrentSessions="1000"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel>
使用单例模式
receiveTimeout="00:10:00",10分钟已经很长了,还超时?
最好贴一下你的implementation部分
最终发现 是iis 不给力...