WCF端点未找到 [英] WCF endpoint not found

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

问题描述

我按照一本书的教程来实现Windows Phone的推送通知。这是服务的标记:

 <%@ ServiceHost的语言=C#调试=真正的服务= Service.PushService代码隐藏=PushService.svc.cs厂=System.ServiceModel.Activati​​on.WebServiceHostFactory%GT; 



正如你所见,一个工厂增加,但我真的不明白它是。当运行服务,我收到了端点未找到错误。当我从标记删除工厂,错误消失,但我得到一个空白页。



任何想法可能会导致此错误或如何解决呢?如果你需要更多的代码,请告诉我。



感谢



编辑:
我的网页。配置:

 < XML版本=1.0>? 
<结构>

<&的appSettings GT;
<添加键=ASPNET:UseTaskFriendlySynchronizationContextVALUE =真/>
< /的appSettings>
<&的System.Web GT;
<编译调试=真targetFramework =4.5/>
<的httpRuntime targetFramework =4.5/>
< /system.web>
< system.serviceModel>
<&行为GT;
< serviceBehaviors>
<&行为GT;
<! - 为了避免泄露的元数据信息,在部署之前设置以下为false值 - >
< serviceMetadata httpGetEnabled =真httpsGetEnabled =真/>
<! - 要接收的异常细节的故障进行调试,下面设置为true值。设置为false部署之前,以避免泄露异常信息 - >
< serviceDebug includeExceptionDetailInFaults =FALSE/>
< /行为>
< / serviceBehaviors>
< /行为>
< protocolMapping>
<添加绑定=basicHttpsBinding计划=HTTPS/>
< / protocolMapping>
< serviceHostingEnvironment aspNetCompatibilityEnabled =真multipleSiteBindingsEnabled =真/>
< /system.serviceModel>
< system.webServer>
<模块runAllManagedModulesForAllRequests =真/>
< - !
。要调试过程中浏览Web应用程序根目录,下面设置为true值。
设置为false部署之前,以避免泄露Web应用程序文件夹的信息。
- >
<启用directoryBrowse =真/>
< /system.webServer>

< /结构>


解决方案

您缺少端点你web.config配置。
添加到您的web.config

 < system.serviceModel> 
<服务和GT;
<服务名称=Service.PushService>
<端点地址=绑定=basicHttpsBinding
合同=Service.IPushService/>
< /服务>
< /服务>
< /system.serviceModel>


I'm following a tutorial in a book to implement push notifications for Windows Phone. This is the markup of the service:

<%@ ServiceHost Language="C#" Debug="true" Service="Service.PushService" CodeBehind="PushService.svc.cs" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>

As you see, a factory is added, although I don't really understand what it's for. When running the service, I get a "endpoint not found" error. When I remove the factory from the markup, the error disappears, but I get an empty page.

Any idea what could cause this error or how to fix it? If you need more code, please tell me.

Thanks

EDIT: My web.config:

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

解决方案

You are missing the endpoint configuration in you web.config. Add this to your web.config

<system.serviceModel>
  <services>
    <service name="Service.PushService">
      <endpoint address="" binding="basicHttpsBinding"
                contract="Service.IPushService" />
    </service>
  </services>
</system.serviceModel>

这篇关于WCF端点未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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