Lo siento por el enunciado del problema a largo ... He pasado dos días depuración y tienen un montón de notas ..."No se pudo encontrar elemento de punto final con el nombre ..."
que tienen un servicio de datos WCF y otro proceso que intenta conectarse a él como cliente a través de TCP y/o HTTP.
Tengo una aplicación de cliente de prueba muy simple que parece conectarse bien, pero la aplicación de producción más complicada no se puede conectar (ni TCP o HTTP). En ambos proyectos de cliente, dejé que Visual Studio 2008 generara app.config usando "Agregar referencia de servicio" y dejando que extraiga los metadatos del servicio de datos.
Aquí está el código para el cliente de prueba simple que funciona:
using Client.MyDataService;
namespace Client
{
class Program
{
static void Main(string[] args)
{
MyDataServiceClient client = new MyDataServiceClient("net.tcp");
client.GetRecords();
}
}
}
Aquí está el código para el más complicado, el cliente de la producción:
DataServiceManager.cs:
using MyServer.MyDataService;
namespace MyServer.DataServiceBridge
{
class DataServiceManager
{
MyDataServiceClient dataServiceClient = new MyDataServiceClient("net.tcp");
}
}
En proceso principal:
DataServiceManager d = new DataServiceManager();
Aquí está el archivo app.config para ambos cliente sencillo cliente y producción:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="net.tcp" 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="net.tcp://localhost:8888/MyDataService"
binding="netTcpBinding" bindingConfiguration="net.tcp" contract="MyDataService.IMyDataService"
name="net.tcp">
<identity>
<userPrincipalName value="COMPUTER_NAME\Username" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
En depuración \ bin \ de MiServidor es MyServer.exe, app.config.
En MyDataSeriviceHost de bin \ Debug \ carpeta es MyDataService.exe, app.config y MyDataSeriviceHost.exe.config. app.config y MyDataSeriviceHost.exe.config son idénticos.
Aquí está el mensaje de error:
An exception of type 'System.InvalidOperationException' occurred in System.ServiceModel.dll but
was not handled in user code
Additional information: Could not find endpoint element with name 'net.tcp' and contract
'MyDataService.IMyDataService' in the ServiceModel client configuration section.
This might be because no configuration file was found for your application, or because no endpoint
element matching this name could be found in the client element.
Alguna idea de lo que está pasando? Agoté bastante a Google. :-(
Probablemente un error tipográfico, pero su error mensaje lee: IyDataService. Probablemente debería ser IMyDataService. –
Sí, eso fue un error al redactar para publicar aquí. Reparado, gracias! – CrypticPrime
por favor no duplique etiquetas como "WCF" en el título. Para eso son las etiquetas. –