简体   繁体   中英

Consume WCF Service which uses an external ip

This situation has me a little stumped. I created a web service when I write an application and consume it with like Add Service Reference, I am able to put in the URL and all. It finds the service just fine. Let's say the internal service is: http://MyMachine.test.com/Test/TestService.svc

I move this up to a point where there are 4 machines and 1 external url under an SLL. There is a load balancer to direct to the appropriate server. Let's say that the external url is https://my.test.com and the web service is called Test/TestService . So, it should be like https://my.test.com/Test/TestService.svc . The 4 other machines are: testa.test.com , testb.test.com , testc.test.com , testd.test.com .

Now again, if I try to consume it from internally everything works fine on any of those 4 machines. If I even try the external URL when I'm connected to the network: https://my.test.com/Test/TestService.svc it'll work too.

However, when I go to another machine is not in the network and I try to write an application to consume the web service using the external ip (url). I does NOT work.

I get a message to the effect that the:

"The document at the url https://my.test.com/TEST/TestService.svc was not recognized as a known document type. The error message from each known type may help you fix the problem: - Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. - Report from 'DISCO Document' is 'There was an error downloading ' http://testa.test.com/Test/TestService.svc?disco ' .'. - Unable to connect to the remote server - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.10.10.110:80 - Report from ' https://my.test.com/Test/TestService.svc ' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. - Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'. Metadata contains a reference that cannot be resolved: ' https://my.test.com/Test/TestService.svc '. Content Type application/soap+xml; charset=utf-8 was not supported by service https://my.test.com/Test/TestService.svc . The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.. If the service is defined in the current solution, try building the solution and adding the service reference again."

I'm external so of course it's not going to connect to 10.10.10.110 or the name of it as testa.test.com . But why is that even in there? I'm trying to get to it from an another machine using the ip/name that is intended for outside locations (ie " https://my.test.com/Test/TestService.svc ")

Does anybody have any idea on what might be the cause of this and how can it be resolved?

This turned out to be a load balancer ACE situation. Something where i could not make any change for.

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