我刚刚开始学习WCF。我已成功使用主机控制台应用程序设置WCF服务。该服务映射到具有Entity Framework的SQL Server。然后我有一个使用该服务的WPF客户端应用程序。这一切在Dev中运行良好,包括从我的机器运行的服务和客户端应用程序:
<endpoint address="http://localhost:8081/" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IRegimesService" contract="RegimesService.IRegimesService"
name="BasicHttpBinding_IRegimesService" />
我现在已将服务和主机转移到我的新VM上。服务主机运行正常。我现在正在尝试配置客户端应用程序端点以连接到该服务。我认为HTTP地址不正确:
服务app.config:
<services>
<service name="diiRegimesService.RegimesService">
<endpoint address="" binding="basicHttpBinding" contract="diiRegimesService.IRegimesService"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8082" />
</baseAddresses>
</host>
</service>
</services>
客户端app.config:
<client>
<endpoint address="http://emea-myserver01.emea.basketballinfo.com/localhost:8082/" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IRegimesService" contract="RegimesService.IRegimesService"
name="BasicHttpBinding_IRegimesService" />
</client>
远程桌面的服务器凭据为:emea-myserver01.emea.basketballinfo.com
我目前没有指定用户名&amp;我的客户端app.config中的密码。
服务正在服务器上运行。我试图在客户端应用程序中添加服务引用时遇到异常。
添加服务参考 - 地址:http://EMEA-myserver01.emea.basketballinfo.com
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://emea-myserver01.emea.basketballinfo.com/'.
答案 0 :(得分:1)
您需要确保服务器能够解析完整的域名。
此外,客户端配置代码段<endpoint address="http://emea-myserver01.emea.basketballinfo.com/localhost:8082/
中提供的地址网址似乎无效。也许您想使用<endpoint address="http://emea-myserver01.emea.basketballinfo.com:8082/