简体   繁体   中英

WebService getting the local address instead of ip address

I trying to run a silverlight app. I have a server with a knowed ip, and I am trying to install the sl app in this server.

The problem is, if I access the service using the ip like: http://serverip:port/Service.svc , the service runs with no problem, but, service shows this: svcutil.exe http://serverLocalAddress:port/Service.svc?wsdl

So, when I run the app from the local domain, I have no problem, but, when I run from outside domain (from my house for example), the app doesn't run correctly, showing a error in the service.

I have configured my ServiceReference.ClientConfig endpoint address with: "http://serverip:port/Service.svc".

There are other place to change to fix this problem?

Regards.

Eduardo.

You may want to be explicit about your address in your code versus in your ClientConfig. This can give your more control over your url, you can event move it to your Application InitParams.

To do this, modify your service declaration to include the address and change this

_proxy = new WCFServiceClient();

to

_proxy = new WCFServiceClient("BasicHttpBinding_IWCFService", "http://serverip:port/Service.svc");

I don't recommend hard coding the address as I've done here, but this should get you started.

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