views:

25

answers:

1

hi, i have an project with name called(dbservice layer) which is in path: d:\webservice\DBService. here i have an webservice which connects to DB and returns an object of an class.

once i added an reference here i get an url:http://localhost:2371/Jobs.svc

now i have another project name (UILayer) whic is in path: E:\School\UILayer i added an service reference here with url as http://localhost:2371/Jobs.svc but i get an messgae telling service is unable why is that happening.

if both my webserivce layer and ui layer are in same project. then i able to use the webserive in the ui layer. and get the required output

so i wanted to know is there any way we can acesss the webserive from one project to another project

thanks in advance

prince

+1  A: 

Publish your web service to an actual location and then add a reference using the actual URL not the one served up by visual studio. What I think is happening is each Visual Studio instance is using a different port so you can't say localhost:2371 for both projects because that is the local port for the instance your running with your original project.

Publish it and then access it via http://localhost/jobs.svc. You should be able to access it via IE directly without running Visual Studio if you have published it correctly.

The main point is, you have the wrong URL.

Kelsey
hi Kelsey, thanks for the replay. once i publish my webserive i am able to access now in any project.i tried with url http://localhost/jobs.svc it would not hit the service. but once i change the url http://localhost:2371/Jobs.svc was able to access the webservice
prince23
@prince23 Yes publishing it is the key and going off of a static URL that is not being hosted by Visual Studio's internal web server. You really should improve your accepted answer rate (it's the check mark near the votes:D ).
Kelsey
have check mark the vote
prince23