消费WCF服务参考:端点未找到/ 404找不到网页 [英] Consuming WCF Service Reference: Endpoint not found / 404 page not found

查看:384
本文介绍了消费WCF服务参考:端点未找到/ 404找不到网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个话题会很熟悉类似的话题,但我可以告诉你,这是我来帮忙相关问题搜索一整天后,因为没有建议的解决方案已经为工作我的。

我创建了一个 WCF REST服务应用程序只有一个,我的计算机上本地运行的服务,以及一个 ASP.NET Web窗体客户端消耗它(无论在在VS 2013的单个实例在Windows 7)。

I have created a WCF REST Service Application with only one service that runs locally on my computer as well as a ASP.NET WebForm Client that consumes it (both on individual instance of VS 2013 on a Windows 7).

的服务工作perfeclty精细所有操作。

All the operations of the service work perfeclty fine.


  • GET 的操作都可以在浏览器中测试成功

  • POST 的操作都可以成功地利用邮差浏览器扩展测试。

  • GET operations can be successfully tested in the browser
  • POST operations can be successfully tested using Postman browser extension.

问题:当我尝试使用客户端上的服务引用访问此服务,例如:

Problem: When I try to access this service using a Service Reference on the client such as:

AuthorRESTServiceClient service = new AuthorRESTServiceClient("AuthorServiceBinding");
string value = service.Test(); //GET operation that should return a "Hello World"

客户端,然后抛出一个 EndpointNotFoundException

有没有终点在听
  的http://本地主机:49414 / AuthorRESTService.svc 是可以接受
  信息。这通常是由一个不正确的地址或SOAP动作引起的。
  见的InnerException,如果present,了解更多信息。

There was no endpoint listening at http://localhost:49414/AuthorRESTService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

和包含内部引发WebException

远程服务器返回错误:(404)未找到

The remote server returned an error: (404) Not Found

下面是部分code在 WCF服务应用程序服务器的的Web.config

Here is the partial code of the WCF Service Application server's Web.config:

  <system.serviceModel>
    <services>
      <service name="WCFAuthorEntryService.AuthorRESTService">
        <endpoint address=""
                  binding="webHttpBinding"
                  contract="WCFAuthorEntryService.IAuthorRESTService"
                  behaviorConfiguration="web">
        </endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

和这里的部分​​code在 ASP.NET网络表单客户端的的Web.config

And here's the partial code of the ASP.NET Webform client's Web.config

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="AuthorServiceBinding"/>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:49414/AuthorRESTService.svc"
                binding="basicHttpBinding"
                bindingConfiguration="AuthorServiceBinding"
                contract="AuthorServiceReference.IAuthorRESTService"
                name="AuthorServiceBinding"/>
    </client>
  </system.serviceModel>

我是什么做错了吗?任何帮助将是非常美联社preciated。

What am I doing wrong? Any help would be much appreciated.

推荐答案

尝试添加客户端项目中的REST服务的Web引用,它会自动进行一些更改您的客户端的web.config和刚刚从删除的协议映射的部分WCF的web.config文件。这可能会帮助你。

Try to add Web Reference of your REST service on client project, it will automatically make some changes to your client web.config and just remove protocol mapping section from your WCF web.config file. This may help you.

这篇关于消费WCF服务参考:端点未找到/ 404找不到网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆