繁体   English   中英

从Localhost开发人员到产品服务器使用WCF服务的WPF客户端?

[英]WPF Client with WCF Service from Localhost dev to prod server?

我才刚刚开始学习WCF。 我已经使用主机控制台应用程序成功设置了WCF服务。 该服务映射到带有实体框架的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我目前未在客户端app.config中指定用户名和密码。

该服务正在服务器上运行。 我在尝试在客户端应用程序中添加服务引用时遇到异常。

添加服务参考-地址:http: 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/'.

您需要确保服务器能够解析完整的域名。

另外,客户端配置摘要<endpoint address="http://emea-myserver01.emea.basketballinfo.com/localhost:8082/中提供的地址url似乎无效。也许您想使用<endpoint address="http://emea-myserver01.emea.basketballinfo.com:8082/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM