1

I created an ASP.NET WEB project in VS2012 and add a WCF Data Service file(.svc).When i run, i can reach it(localhost:61388/default.svc), but i can't reach it in another computer by typing my host's ip address(192.168.1.4:61388/default.svc) and it shows BAD REQUEST-INVALID HOST NAME. Then how can I reach my wcf data service from another computer? I've turned off all firewalls and my os is windows 7 Pro

Lazy_Clutch
  • 130
  • 3
  • 14
  • 192.168.1.4:61388/default.svc, also make sure you don't have a firewall running. You can't do this with the cassini built in web server, you need to use iis or iis express. – BNL Jul 24 '13 at 15:05
  • the port was right and i've turned off firewall, how to use iis or iis express? – Lazy_Clutch Jul 24 '13 at 15:10
  • http://stackoverflow.com/questions/3355138/developing-in-visual-studio-2010-with-the-new-iis-express-web-server – BNL Jul 24 '13 at 15:12

3 Answers3

0

For that you need to host your WCF service in IIS server...To learn more about IIS server and add website see this

BY default there is a default website running at port 80.(You can check by typing http:\localhost) If you dont get anything that means IIS is not installed in your PC.

Once your IIS is up and running add your WCF service to IIS just like you add website to IIS (Or directly publish your WCF service in IIS publish-->IIS) and give it a specific port number (lets say your WCF service is running at 81).you can access the service from other computer (Lets say the PC which host has ip 10.20.50.121)...then you can access it on another computer by typing 10.20.50.121:81.

Now to connect your WCF service to Website,you need to check if your wcf service is running or not.For that when you publish your wcf service to IIS you get 3 files out of which one is default.svc(or any of your name you can click on the service go to contents view and see it) click it and on the right hand side click browse if you see a success page that your service is running then you need to copy that address an paste it in your Website webconfig endpoint address location and change the appopriate dns value .That should get your WCF service started

Rohit
  • 10,056
  • 7
  • 50
  • 82
  • yes, i know what you've said. I do have installed iis and the default page is just my project. But i don't know what to do next. I mean, i don't know the connection between it and my data service... – Lazy_Clutch Jul 24 '13 at 15:19
  • so your Issue is to connect WCF service and website?? – Rohit Jul 24 '13 at 15:20
  • yes, if i can reach my website via LAN(e.g 10.20.50.121:81), then can I directly reach my data service?(10.20.50.121:81/default.svc) – Lazy_Clutch Jul 24 '13 at 15:26
  • Generally i've learned your idea.But i don't know how to operate it. I mean, how to publish my wcf data service to IIS? BTW:What I mean is WCF data service instead of WCF service(I don't know the difference between them either.) Sorry to say that maybe my question is so simple but i'm a rookie.. – Lazy_Clutch Jul 24 '13 at 15:32
  • http://stackoverflow.com/questions/3764469/how-to-host-wcf-data-service-odata-in-iis7 and http://msdn.microsoft.com/en-us/data/gg192995.aspx – Rohit Jul 24 '13 at 15:37
0

can you access it from your own computer using 192.168.1.4:61388/default.svc ? Or only localhost ? Run netstat -a and check the webserver is actually binding to the 1.4 address and not just to your local loopback adapter (127.0.0.1).

steve cook
  • 3,116
  • 3
  • 30
  • 51
0

Create a virtual directly pointing to folder where your wcf svc is lying and try accessing it.