简体   繁体   English

找不到名称为WCF的端点元素

[英]Could not find endpoint element with name WCF

I send name to endpoint but I get error. 我发送名称到端点但我收到错误。

Error: 错误:

Could not find endpoint element with name 'HTTP_Port' and contract 'WSPI.InvoiceCheck_Out' in the ServiceModel client configuration section. 找不到名为“HTTP_Port”的端点元素,并在ServiceModel客户端配置部分中收缩“WSPI.InvoiceCheck_Out”。 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. 这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此名称匹配的端点元素。

在此输入图像描述

WebConfig: WebConfig:

<client>
            <endpoint address="https://example.company.eu:51201"
                binding="basicHttpBinding" bindingConfiguration="InvoiceCheck_OutBinding"
                contract="WSPI.InvoiceCheck_Out" name="HTTP_Port" />
            <endpoint address="https://example.company.eu:51201"
                binding="basicHttpBinding" bindingConfiguration="InvoiceCheck_OutBinding1"
                contract="WSPI.InvoiceCheck_Out" name="HTTPS_Port" />
</client>

I put this here work correct App.config : 我把这个工作正确的App.config

<?xml version="1.0"?>
<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727"/>
  </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SharePoint" publicKeyToken="71E9BCE111E9429C" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-14.0.0.0" newVersion="14.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>

  </runtime>
    <system.serviceModel>
      <bindings>
        <basicHttpBinding>
          <binding name="InvoiceCheck_OutBinding" />
          <binding name="InvoiceCheck_OutBinding1">
            <security mode="Transport" />
          </binding>
        </basicHttpBinding>
      </bindings>
      <client>
        <endpoint address="http://test"
            binding="basicHttpBinding" bindingConfiguration="InvoiceCheck_OutBinding"
            contract="WSPI.InvoiceCheck_Out" name="HTTP_Port" />
        <endpoint address="https://test"
            binding="basicHttpBinding" bindingConfiguration="InvoiceCheck_OutBinding1"
            contract="WSPI.InvoiceCheck_Out" name="HTTPS_Port" />
      </client>
    </system.serviceModel>
</configuration>

Because you are referencing this code as a dll your code is going to be checking your application (in your case your console app) that is referencing it for the configuration. 因为您将此代码作为dll引用,所以您的代码将检查您的应用程序(在您的情况下是您的控制台应用程序),该应用程序引用它以进行配置。 Try taking your <System.ServiceModel> configuration from your dll and adding it to the app.config for your console application that should work. 尝试从您的dll获取<System.ServiceModel>配置,并将其添加到应该适用的控制台应用程序的app.config中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM