嗨,我遇到连接到wcf服务的wpf应用程序的问题。该服务有一个netTcpBinding并使用http方案,如果我尝试使用netTcpBinding连接到它我得到错误 提供的URI方案' http'是无效的;预期' net.tcp'。参数名称:via
这是网络配置
<netTcpBinding>
<binding name="netTcpBindingConfig" closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00"
transactionFlow="false" transferMode="Buffered"
transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288"
maxBufferSize="65536" maxConnections="10"
maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows"
protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
结束点
<endpoint address="http://FinanceIccWS_5_0/IccService.svc"
binding="netTcpBinding" bindingConfiguration="netTcpBindingConfig"
contract="Gatherers.ICCService.ICCService" name="NetTcpBinding_ICCService" >
<identity>
<userPrincipalName value="cssqaaspsvc@corp.fmglobal.com" />
</identity>
然后代码theres是一种catch方法,但没有看到它是相关的
string address = "http://FinanceIccWS_5_0/IccService.svc?wsdl";
EndpointAddress endpointAddress = new EndpointAddress(address);
NetTcpBinding binding = new NetTcpBinding("netTcpBindingConfig");
try
{
var proxy = new CCServiceClient(binding,endpointAddress);
proxy.Open();
test.TestDetails = proxy.State.ToString();
test.TestPassed = true;
report.RetrievalStatus = RetrievalStatus.Succeeded;
report.ApplicationStatus = ApplicationStatus.Passed;
}
尝试使用协议映射,但似乎没有做任何事情
<protocolMapping>
<add scheme="http" binding="netTcpBinding" bindingConfiguration="netTcpBindingConfig"/>
</protocolMapping>