简体   繁体   English

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

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

I am just starting to learn WCF. 我才刚刚开始学习WCF。 I have successfully set up a WCF service with host console app. 我已经使用主机控制台应用程序成功设置了WCF服务。 The service maps to SQL Server with Entity Framework. 该服务映射到带有实体框架的SQL Server。 I then have a WPF client app which consumes the service. 然后,我有一个使用该服务的WPF客户端应用程序。 This all works fine in Dev, both the service and client app running from my machine: 所有这些都可以在Dev中正常运行,无论是从我的机器上运行的服务还是客户端应用程序:

<endpoint address="http://localhost:8081/" binding="basicHttpBinding"
    bindingConfiguration="BasicHttpBinding_IRegimesService" contract="RegimesService.IRegimesService"
    name="BasicHttpBinding_IRegimesService" />    

I have now transferred the service and host onto my new VM. 现在,我已将服务和主机转移到我的新VM上。 The service host runs fine. 服务主机运行正常。 I am now trying to configure the client app endpoint to connect to the service. 我现在正在尝试配置客户端应用程序端点以连接到服务。 I think the HTTP address is incorrect: 我认为HTTP地址不正确:

Service app.config: 服务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>

Client app.config: 客户端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>

The server credentials for remote desktop are: emea-myserver01.emea.basketballinfo.com I currently don't specify a username & password in my client app.config. 远程桌面的服务器凭据为: emea-myserver01.emea.basketballinfo.com我目前未在客户端app.config中指定用户名和密码。

The service is running on the server. 该服务正在服务器上运行。 I'm getting an exception trying to add the service reference in the client app. 我在尝试在客户端应用程序中添加服务引用时遇到异常。

Add Service Reference- Adress: http://EMEA-myserver01.emea.basketballinfo.com 添加服务参考-地址: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/'.

You need to make sure the server is able to resolve the full domain name. 您需要确保服务器能够解析完整的域名。

Also, the address url provided in the client configuration snippet <endpoint address="http://emea-myserver01.emea.basketballinfo.com/localhost:8082/ does not seem valid. Perhaps you want to use <endpoint address="http://emea-myserver01.emea.basketballinfo.com:8082/ 另外,客户端配置摘要<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