[英]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.