«Не удалось найти элемент конечной точки с именем…»

Извините за длинную формулировку проблемы ... Я потратил два дня на отладку и у меня много записей

У меня есть служба данных WCF и другой процесс, пытающийся подключиться к нему в качестве клиента через TCP и / или HTTP.

У меня ОЧЕНЬ простое тестовое клиентское приложение, которое вроде бы нормально подключается, но более сложное производственное приложение не может подключиться (ни TCP, ни HTTP). В обоих клиентских проектах я позволил Visual Studio 2008 сгенерировать app.config с помощью «Добавить ссылку на службу» и позволить ей извлекать метаданные из службы данных.

Вот код для простого тестового клиента, который работает:

using Client.MyDataService;

namespace Client
{
    class Program
    {
        static void Main(string[] args)
        {
            MyDataServiceClient client = new MyDataServiceClient("net.tcp");

            client.GetRecords();
        }
    }
}

Вот код для более сложного, производственного клиента:

DataServiceManager.cs:

using MyServer.MyDataService;

namespace MyServer.DataServiceBridge
{
    class DataServiceManager
    {
        MyDataServiceClient dataServiceClient = new MyDataServiceClient("net.tcp");
}
}

В основном процессе:

DataServiceManager d = new DataServiceManager();

Вот файл app.config для простого клиента и производственного клиента:

<?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>

В папке bin \ Debug \ MyServer находится MyServer.exe, app.config.

В папке bin \ Debug \ MyDataSeriviceHost находятся MyDataService.exe, app.config и MyDataSeriviceHost.exe.config. app.config и MyDataSeriviceHost.exe.config идентичны.

Вот сообщение об ошибке:

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.

Есть идеи, что происходит? Я в значительной степени исчерпал Google. :-(

Ответы на вопрос(5)

Ваш ответ на вопрос