Click here to Skip to main content
15,881,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I have developing an application by my own and stuck in a concept. Let me explain the whole scenario that will help you understand exactly what I want.

I have two projects in a solution. One of them is a web service and another one is a simple web application. The web application need to refer the web service. For that, I have to add the web service as the reference in my web application.
Now, I cannot be able to understand that if I simply add the service as the reference, then how the web application is going to access that?

Can anybody help me out this whole thing step by step? Please guys, I need help

Thanks.
Posted
Comments
DamithSL 2-Aug-15 9:08am    
is it working after you add service reference?
Member 11072126 2-Aug-15 14:02pm    
Thank you for the reply. Actually, I need to host the service separately and the asp.net application separately. So, while developing, how to test them? Do I need to host both of them in IIS and then to refer the service in the asp.net application?
If that so, then while deployment how do I change the service reference url? Because, I am going to deploy the dll for both of them.
DamithSL 2-Aug-15 14:10pm    
while developing you ca run both projects at ones, no need to deploy in IIS, google for "visual studio multiple startup projects" you will find how to run both service and web project at one in VS
when you deploy, you can first deploy the web service in iis and add reference to that deployed service from your web application by adding service reference. if there is no change in service which you locally running and hosted in iis you can even change the web service url in the web config file in your web application
Member 11072126 3-Aug-15 5:44am    
Thank you. It helped me a lot. I understood the flow now.
Kornfeld Eliyahu Peter 2-Aug-15 16:30pm    
As long as you call the web service from jQuery (from the client) you need no reference on the server side whatsoever...
The best approach - IMHO - is to open two VS instances one for the service and one for the side...

If web service framework is WCF and web application is ASP.NET, then I already have produced an article for that. Creating a Web Service to be consumed by connected Devices via Internet[^]

Let me tell you how that was done, (I would start after "This is up for the web service, let us now write the client") the web service to reference needs to be running. In my case it was hosted in a console project, which was kept running and then I selected Add Service Reference. That references it. Once that has been done, you can manage the web application to work as a client for that web service. As a client, your web application would be able to send requests to the server.

I would recommend that you read the article I provided, or at the best. You try to learn how WCF handles requests from their clients. Having a deep knowledge of how things work is the key to building a framework.

https://msdn.microsoft.com/en-us/library/ms733133(v=vs.110).aspx[^]
https://msdn.microsoft.com/en-us/library/ms734691(v=vs.110).aspx[^]

Read this as a very quick and short documentation: https://msdn.microsoft.com/en-us/library/bb386386.aspx[^]
 
Share this answer
 
Comments
Member 11072126 2-Aug-15 14:02pm    
Thanks. This is obviously helpful. Let me go through it properly and then I might again ask you if I have any other queries.
Thanks a lot.
Afzaal Ahmad Zeeshan 3-Aug-15 6:59am    
You are most welcome for further queries.
aarif moh shaikh 3-Aug-15 6:01am    
Agree with you ... 5
Afzaal Ahmad Zeeshan 3-Aug-15 6:59am    
Thank you, Aarif.
 
Share this answer
 
Comments
Member 11072126 2-Aug-15 14:00pm    
Thank you for the reply. Actually, I need to host the service separately and the asp.net application separately. So, while developing, how to test them? Do I need to host both of them in IIS and then to refer the service in the asp.net application?
If that so, then while deployment how do I change the service reference url? Because, I am going to deploy the dll for both of them.
sasanka sekhar panda 3-Aug-15 0:03am    
There is no need to host the service in the same iis or in the same server for testing.
..First test your web service completely..Then add the reference to your asp.net app. If your web service url changes then update your service reference in asp.net app simple..
Member 11072126 3-Aug-15 5:47am    
Ok. Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900