Reputation: 2282
I am getting "Either the target name is incorrect or the server has rejected the client credentials." message when I change the configuration from localhost to the QA server.
Below is where the code fails:
ServiceReference1.MaestroServiceClient client;
try
{
client = new ServiceReference1.MaestroServiceClient("NamedPipes");
client.ClientCredentials.UserName.UserName = "xxx";
client.ClientCredentials.UserName.Password = "xxx";
// fails on this line
lbRateCards.ItemsSource = ((System.Data.DataTable)client.GetRateCardsDataTable(networkId)).DefaultView;
lbRateCards.DisplayMemberPath = "RATECODE";
lbRateCards.SelectedValuePath = "RATECARDID";
}
catch (Exception ex)
{
lbRateCard.Content = ex.Message + ": " + ex.StackTrace.ToString();
}
I added the username and password to see if that would affect the result. as you can see it connects to the service but fails when it executes a method.
Any help is appreciated. I have banging my head all week on this.
Below is my app.config. I am going from a WPF browser app to a wfc service.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMaestroService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<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>
<netNamedPipeBinding>
<binding name="NamedPipes" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false"
transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport protectionLevel="EncryptAndSign" />
</security>
</binding>
</netNamedPipeBinding>
<netTcpBinding>
<binding name="NetTcpBinding_IMaestroService" 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" maxArrayLength="16384"
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>
</bindings>
<client>
<endpoint address="http://xxx:8080/MaestroService/basic"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMaestroService"
contract="ServiceReference1.IMaestroService" name="BasicHttpBinding_IMaestroService" />
<endpoint address="net.tcp://xxx:8888/MaestroService" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IMaestroService" contract="ServiceReference1.IMaestroService"
name="NetTcpBinding_IMaestroService">
<identity>
<userPrincipalName value="[username]@[domain]" />
<dns/>
</identity>
</endpoint>
<endpoint address="net.pipe://lax-qa-rests01/MaestroService" binding="netNamedPipeBinding"
bindingConfiguration="NamedPipes" contract="ServiceReference1.IMaestroService"
name="NamedPipes">
<identity>
<userPrincipalName value="[username]@[domain]" />
<dns value ="xxx"/>
</identity>
</endpoint>
</client>
Upvotes: 0
Views: 3820
Reputation: 364269
You can't change configuration from localhost to QA server unless your WPF application is running on QA server as well (and it such case you can still use localhost). Limitation of Named Pipes in WCF is that it can be used only for interprocess communication on the same machine. So, if your client and service are running on different machines you can't use named pipe based bindings for communication.
Upvotes: 1