简体   繁体   中英

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

I am just starting to learn WCF. I have successfully set up a WCF service with host console app. The service maps to SQL Server with Entity Framework. I then have a WPF client app which consumes the service. This all works fine in Dev, both the service and client app running from my machine:

<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. 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:

Service 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:

<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.

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

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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