简体   繁体   English

WCF面临的问题:找不到默认端点

[英]Facing issue with WCF: Could not find default endpoint

I created a WCF service in separate project name is AaWs then added this project in a website project as a reference . 我在单独的项目名称AaWs中创建了WCF服务,然后将该项目添加到网站项目中作为参考。 website project name is AaNuWs 网站项目名称为AaNuWs

in website project web.config file is 在网站项目web.config文件中是

  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mexBehavior">
          <serviceMetadata httpGetEnabled="True"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="mexBehavior" name="AaWs.RxtraIntroService">
        <endpoint address ="AaWs" binding="basicHttpBinding" contract="AaWs.IRxIntro">
        </endpoint>
        <host>
          <baseAddresses>
            <add baseAddress = "http://localhost:8080" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
</configuration>

then uploaded this website project on my web server. 然后将此网站项目上传到我的网络服务器上。

then give the service reference in my new project from my website with a name space 然后在我的新项目中通过我的网站在名称空间中提供服务参考

IntroService 介绍服务

http://mywebsite/IntroService.svc?wsdl

new system create a new app.config file for me 新系统为我创建一个新的app.config文件

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IRxIntro" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://mywebsite/IntroService.svc/RecoverInfoTechAaWs"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRxIntro"
                contract="IntroService.IRxIntro" name="BasicHttpBinding_IRxIntro" />
        </client>
    </system.serviceModel>
</configuration> 

but now when i trying to access this service i am getting a error. 但是现在当我尝试访问此服务时,出现错误。

System.InvalidOperationException: Could not find default endpoint element that references contract 'IntroService.IRxIntro' in the ServiceModel client configuration section. System.InvalidOperationException:在ServiceModel客户端配置部分中找不到引用合同'IntroService.IRxIntro'的默认终结点元素。 This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element. 这可能是因为找不到您的应用程序的配置文件,或者是因为在客户端元素中找不到与该协定匹配的端点元素。

please help me on this 请帮助我

You need to confirm that the app.config is in the root folder with your executable. 您需要确认app.config位于可执行文件的根文件夹中。 Then confirm that the app.config has the proper value for: 然后确认app.config具有以下适当的值:

<client>
 <endpoint ... contract=""

From the information you provided, the address information does not look correct. 根据您提供的信息,地址信息看起来不正确。 Your service has an overall address of " http://localhost:8080/AaWs " but your service reference (wsdl url) shows " http://mywebsite/IntroService.svc?wsdl ". 您的服务的总地址为“ http:// localhost:8080 / AaWs ”,但是您的服务引用(wsdl url)显示为“ http://mywebsite/IntroService.svc?wsdl ”。 You surely want to make sure that you are pointing to the correct service when generating the reference. 您肯定要确保在生成参考时您指向正确的服务。

从app.config的端点配置中删除name =“ BasicHttpBinding_IRxIntro”属性。

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

相关问题 在WCF客户端中找不到默认端点元素… - Could not find default endpoint element … in WCF Client WCF 端点错误:找不到默认端点元素 - WCF Endpoint Error: Could not find default endpoint element 找不到引用合同的默认端点元素 - 托管wcf - Could not find default endpoint element that references contract - Hosting wcf WCF错误 - 找不到引用合同的默认端点元素 - WCF Error - Could not find default endpoint element that references contract 使用WCF服务 - 找不到默认端点元素 - Consume WCF Service - Could not find default endpoint element 在WCF中找不到引用合同的默认终结点元素 - Could not find default endpoint element that references contract in WCF WCF运行时异常“找不到引用的默认终结点元素……” - WCF Runtime Exception “Could not find default endpoint element that references…” WCF 安装程序 class - 找不到引用合同的默认端点元素 - WCF installer class - Could not find default endpoint element that references contract 找不到引用合同的默认终结点元素:通过Powershell cmdlet连接到WCF终结点 - Could not find default endpoint element that references contract :connect to WCF endpoint through Powershell cmdlet WCF Rest服务引用了另一个由WCF服务托管的应用程序。 找不到默认端点? - WCF Rest service referencing another application hosted WCF Service. Could not find default endpoint?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM