首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WCF服务WindowsPhone - EndpointNotFoundException

WCF服务WindowsPhone - EndpointNotFoundException
EN

Stack Overflow用户
提问于 2012-02-14 17:49:53
回答 2查看 367关注 0票数 0

我正在WCF服务和Windows Phone客户端应用程序中开发解决方案。问题是我无法连接到服务,即使是在模拟器中,当我在Internet Explorer中键入服务的地址时,我会得到正确的结果。我的配置文件:

代码语言:javascript
复制
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IMyCustomService" 
                         maxReceivedMessageSize="2147483647" 
                         maxBufferSize="2147483647" 
                         enableHttpCookieContainer="true"
                          />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:2395/MyCustomService.svc"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyCustomService"
                contract="MyService.IMyCustomService" name="BasicHttpBinding_IMyCustomService" />
        </client>
    </system.serviceModel>
</configuration>

我的服务接口:

代码语言:javascript
复制
[ServiceContract]
[ServiceKnownType(typeof(CustomResponse))]
public interface IMyCustomService
{
        [OperationContract]
        CustomResponse GetData();
}

我的问题是,每次我尝试调用客户端代理GetDataAsync()方法时,完成的事件都不会被触发,并且我得到"EndpointNotFoundException“。我已经尝试了我找到的所有解决方案,但没有一个对我有帮助。我也尝试制作WPF测试客户端,它可以正常工作,但Windows Phone应用程序不能。

EN

回答 2

Stack Overflow用户

发布于 2012-02-14 21:20:12

我假设这是您的客户端配置,例如电话。您指向的是localhost,但由于您在手机上的模拟器中,localhost解析到的是相同的内容,而不是托管服务的PC。

代码语言:javascript
复制
address="http://localhost:2395/MyCustomService.svc" 

把你电脑的主机名放进去,你就没问题了。

票数 2
EN

Stack Overflow用户

发布于 2012-02-15 17:14:54

嗯,我不知道它是怎么开始工作的,但它确实起作用了。我上传我的服务到互联网主机,从我的手机客户端项目中删除所有服务引用,并再次添加它们与互联网地址,它现在工作。谢谢你的帮助Dominik。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9274776

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档