views:

37

answers:

3

I have a WCF service which I would like to access using ASP.NET. The binding used in the WCF service is basicHttpBinding. How may I do it? Any examples will be really appreciated.

Will it work fine if I create a proxy from the svcutil.exe and then use that class in an ASP.NET page?

A: 

Check links below for tutorials

http://weblogs.asp.net/dwahlin/archive/2006/10/29/Getting-Started-with-Windows-Communication-Framework.aspx

http://www.aspnettutorials.com/tutorials/advanced/introduction-to-wcf-vb.aspx

http://www.dotnetspark.com/kb/1841-basics-endpoint-wcf-tutorial.aspx

Good Luck!

hgulyan
The links you posted doesn't show how to do one with ASP.NET. They're just the basics for WCF
Pazk
@Pazk: there's nothing special about calling a WCF service from ASP.NET - it's just like calling WCF from any other place......
marc_s
@Pazk What about the second link?
hgulyan
@hgulyan: Sorry, I skimmed through that one because of VB and didn't see it. Thanks I'll look into it.
Pazk
+1  A: 

You can access a WCF service in (the codebehind of) an ASP.NET application just like in any other .NET application type. Just add the service reference to the Project and instantiate the proxy.

Henk Holterman
There won't be any side effects? Anything to be aware of?
Pazk
No, just the delay, but that is the same for a database query.
Henk Holterman
You mean everytime I access it there'll be a delay? How can I do something so that it doesn't recreate the connection everytime. I want to query the service constantly (with 2-3 secs delay) and update the page using AJAX.
Pazk
Everything causes a delay. I didn't say it has to be big, that depends on the server and the network. You will have to match your requirements with the available bandwidth.
Henk Holterman
A: 

You need to add a service reference in your asp.net website project (here named ServiceReference1) and then here's your client:

var serviceClient = new ServiceReference1.Service1Client();
Jonny Cundall