Я получаю сообщение "Либо целевое имя неверно, либо сервер отклонил учетные данные клиента".сообщение, когда я меняю конфигурацию с локального хоста на сервер QA.
Ниже приведен код ошибки:
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();
}
Я добавил имя пользователя и пароль, чтобы посмотреть, повлияет ли это на результат.как вы можете видеть, он подключается к службе, но не работает, когда выполняет метод.
Любая помощь приветствуется.Я целую неделю бьюсь головой об этом.
Ниже приведен мой app.config.Я перехожу из приложения браузера WPF в службу wfc.
<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>