我的WCF服務[使用basicHttpBinding]託管在IIS 6.Am上,可以在IE瀏覽器的服務URL中使用?wsdl訪問它。這個WCF錯誤的原因是什麼?
我在我的winforms客戶端有一個presenation層,我添加了這個服務的引用,使用VS.Net中的ServiceReferences選項,然後生成一個代理。
當我在這個服務上調用一個方法時,得到這個異常。我在這裏可能會錯過什麼?謝謝。
「值不能爲空。參數名稱uri。」在 System.ServiceModel.Description.ClientViaBehavior..ctor(URI URI)
在System.ServiceModel.Configuration.ClientViaElement.CreateBehavior() 在 System.ServiceModel.Description.ConfigLoader.LoadBehaviors [T](ServiceModelExtensionCollectionElement1 behaviorElement, KeyedByTypeCollection
1行爲布爾 commonBehaviors)在 System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint,字符串configurationName)
在System.ServiceModel.ChannelFactory.ApplyConfiguration(字符串 configurationName)在 System.ServiceModel.ChannelFactory.InitializeEndpoint(字符串 configurationName,的EndpointAddress地址)在 System.ServiceModel.ChannelFactory
1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) at System.ServiceModel.EndpointTrait
1.CreateSimplexFactory()在 System.ServiceModel.EndpointTrait1.CreateChannelFactory() at System.ServiceModel.ClientBase
1.CreateChannelFactoryRef(EndpointTrait1 endpointTrait) at System.ServiceModel.ClientBase
1.InitializeChannelFactoryRef ()處 TestingClient..ctor(c)中 System.ServiceModel.ClientBase`1..ctor():\演示\服務 參考\ ServiceReference1 \ Reference.cs:線268
這裏是我的配置xm l對於服務器和客戶端:
*服務器:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ProviderBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="PTSWeb.PriceTestingService" behaviorConfiguration="PTSWeb.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="basicHttpBinding" contract="PTSWeb.IPriceTesting">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="PTSWeb.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
*客戶端:
<system.serviceModel>
<client>
<endpoint address="http://localhost/PTSWeb/PTSWebService.svc"
behaviorConfiguration="PTSWeb.Service1Behavior" binding="basicHttpBinding"
bindingConfiguration="IPriceTestingBinding" contract="IPriceTesting"
name="IPriceTestingPort" />
<endpoint address="https://qaserver/webservice"
binding="basicHttpBinding" bindingConfiguration="ProviderBinding"
contract="Provider" name="ProviderPort" />
</client>
<bindings>
<basicHttpBinding>
<binding name="IPriceTestingBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None" />
</binding>
<binding name="ProviderBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="PTSWeb.Service1Behavior">
<clientVia/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
請同時顯示ServiceModel配置(客戶端/服務器) – VdesmedT
當然VdesmedT.Have現在添加XML細節我question.Thanks。 – Jimmy