Why can't I hit my WCF service from the outside of the machine, but can I do it locally?

I have a WCF Self Hosted service running on a machine with IIS setup. The standalone service starts without problems, and I can actually access the wsdl path after it starts and starts.

If I try to click the following addresses on the computer, it will load a web page that talks about svcutil.exe and how to access the service.

http://myspecialservice:9000/ http://192.168.1.230:9000/ 

However, if I try to click the same address from another computer. I get nothing. No errors, the page simply could not be loaded. And I tested to make sure that I resolve the correct IP address when I use the hostname.

In addition, I have configured a service for .exe that will be enabled in the Windows Security Firewall. For all Ethernet profiles and any port. Any advice would help a lot. Again, I know that the service is available locally on the machine and that it works correctly. I think I missed the configuration of the machine somewhere.

 <?xml version="1.0"?> <configuration> <system.diagnostics> <trace autoflush="true"> <listeners> <add name="TextWriter" type="System.Diagnostics.TextWriterTraceListener" initializeData="trace.log"/> <add name="Console" type="System.Diagnostics.ConsoleTraceListener"/> <remove name="Default"/> </listeners> </trace> </system.diagnostics> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="CustomHttpBinding" maxReceivedMessageSize="2147483647"> <readerQuotas maxStringContentLength="2147483647"/> </binding> </basicHttpBinding> </bindings> <client/> <services> <service name="MyService.Data.Service" behaviorConfiguration="serviceBehavior"> <clear/> <endpoint address="JobsHttp" binding="basicHttpBinding" contract="MyService.Data.IWhereItSits" bindingConfiguration="CustomHttpBinding"></endpoint> <endpoint binding="mexHttpBinding" name="httpmex" contract="IMetadataExchange"></endpoint> <host> <baseAddresses> <add baseAddress="http://myspecialservice:9000/"/> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="serviceBehavior"> <serviceMetadata httpGetEnabled="true"/> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> 

EDIT 1

Thus, opening port 9000 on the firewall instead of specifying a rule for service.exe allowed me to get into the service on the local network. Now I'm trying to use the service from the outside world. I added a rule for my router to direct any traffic from port 9000 to the server itself, but I get nothing.

EDIT 2

I installed Network Monitor on the web server, and I can confirm that the router sends traffic back to the server itself. And then the server tries to send a response.

EDIT 3

It makes no sense to me at all. There are two computers on the server, I aimed at 1 IP address from the router to the server. I changed it to another IP and it works from the outside, any explanations or answers?

+4
source share
1 answer

In your corrections, you say that you were able to contact your server, but 192.168.1.230 is the local address. It is valid only on your local network. Your IP address for the outside world is different.: /


Edit

What is your IIS listening to? Perhaps you have the bindings (IIS-> your site-> right click-> Edit bindings) set only for another ip. If this change of IP address to "All Unassigned" should make your service respond to the first ip, too.

0
source

Source: https://habr.com/ru/post/1484516/


All Articles