问题
I have an application written in ASP.NET MVC 4. I got access to remote web service. I added it to my solution as WebReference. When i call it's methods on my localhost all works great, the problem is on deployed version. Server provider run it as "Medium Trust". When i call WebService methods from hosted application i got an error:
I think the problem is in firewall rules on hosting server, my binding type for the service is "basicHttpBinding" with defaults settings. In this case my listening port is random, so how i can get through it? How to set static listening port for WebService response, so i can ask hosing provider to set firewall port open for my application?
My binding config:
<client>
<endpoint address="http://WebServiceURL:8585/Api" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IETRService" contract="ETRService.IETRService" name="BasicHttpBinding_IETRService" />
</client>
回答1:
When you deploy, you should be listening on a standard port, I would assume (remove the port :8585) from your local testing in order to connect to your server.
<client>
<endpoint address="http://WebServiceURL/Api" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IETRService" contract="ETRService.IETRService" name="BasicHttpBinding_IETRService" />
</client>
来源:https://stackoverflow.com/questions/16107865/hosting-provider-blocks-webservice-response-1and1-hosting