寫了一個WCF Serivces供外部程序通過.NET Businesss Connector調用AX的代碼,第一次調用的時候總是很慢,有時候甚至超過1分鍾,訪問地址改成http://localhost的時候第一次調用又很快,改成IP地址后第一次就非常慢。
之所以這樣是因為通過添加服務引用的方式生成的配置文件里,默認把useDefaultWebProxy設置為true了,這種情況下在連接WCF Serives的時候客戶端總是嘗試查找代理,找不到后再直接連,這個時間很長,所以會出現超時,解決辦法是把這個屬性改成false,不讓它找代理。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_AXServices" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="true" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.0.110:8889/AXServices" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_AXServices" contract="AXServices.AXServices"
name="BasicHttpBinding_AXServices" />
</client>
</system.serviceModel>
</configuration>