c# - WCF REST Service (self-hosted) accessible only in local network (and must be accessed remotely) -


i have self-hosted rest service (in c#) works in local network, unreachable remotely. here hosting code:

static uri baseaddress = new uri("http://m.y.i.p:8080"); webservicehost servicehost = new webservicehost(typeof(webservice.restservice),     baseaddress); servicehost.open(); 

(which run in windows forms, btw).

here app.config:

<?xml version="1.0"?> <configuration> <system.servicemodel> <bindings> </bindings> <services>     <service name="webservice.restservice" behaviorconfiguration="default">     <host>       <baseaddresses>       </baseaddresses>     </host>     <endpoint address="" binding="webhttpbinding"            behaviorconfiguration="webbehavior"            contract="webservice.icarga">     </endpoint>   </service> </services> <behaviors>   <endpointbehaviors>     <behavior name="webbehavior">       <webhttp />     </behavior>   </endpointbehaviors>   <servicebehaviors>     <behavior name="default">       <servicemetadata httpgetenabled="true"/>       <datacontractserializer maxitemsinobjectgraph="2147483647"/>     </behavior>   </servicebehaviors> </behaviors> </system.servicemodel> <startup> <supportedruntime version="v4.0" sku=".netframework,version=v4.0"/> </startup> </configuration> 

when, in browser, enter 10.1.1.1:8080/test, shows want. when type m.y.i.p:8080/test, unreachable. firewall off, i'm running administrator , tried netsh command. port 8080 correctly forwarded pc. how can make accessible remotely?

thanks.

edit: people looking in future, had problem router (my ip changed, , didn't change in router). should work if define app.config right. if have problem, double check code, sure network working way expect to, if needed turn off firewall , if you're not administrator, use answer this question or this ms page own desired port.

change

new uri("http://m.y.i.p:8080"); 

to

new uri("http://0.0.0.0:8080"); 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -