[英]WCF endpoint not found
I'm following a tutorial in a book to implement push notifications for Windows Phone. 我正在按照书中的教程来实现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. 运行该服务时,我收到
"endpoint not found"
错误。 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: 编辑:我的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 your web.config. 您缺少web.config中的端点配置。
Add this to your web.config: 将其添加到您的web.config:
<system.serviceModel>
<services>
<service name="Service.PushService">
<endpoint address="" binding="basicHttpsBinding"
contract="Service.IPushService" />
</service>
</services>
</system.serviceModel>
For those who absently implement the method in Service.svc that its definition is absent in IService causes the same exception. 对于那些在Service.svc中缺少实现该方法的人来说,IService中缺少其定义会导致相同的异常。
This is forgotten 这是被遗忘的
[OperationContract]
string CheckHMAC(string hMac);
But implemented 但实施了
[WebInvoke(Method = "GET", UriTemplate = "/CheckHMAC/{hMac}")]
public string CheckHMAC(string hMac)
{//}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.