tags:

views:

39

answers:

2

Is there a way to call a WCF directly while still developing locally?

When I run my WCF project the config file has the following:

http://localhost:8732/Design_Time_Addresses/Design_Time_Addresses/MFA_WCF/Service1/

When I input this line as my URL in the browser (adding the method) a blank page shows up... I was hoping for some message or something. I'm looking for the URL so I can plug it into my jQuery call like I did when I was working on .ASMX files.

Originally my webservices were in the same project as my .js files so I would call it like this:

url: "../webService/file.asmx/methodName",

But now I've broken out the WCF into its own project (still within the solution). What URL should I put when I'm trying to access my WCF?

Thanks!

A: 

If you are using the built-in Visual Studio web server, you need to start your website from within Visual Studio to start the web server. Is your WCF project open and running? You can also use IIS (if you have it on your development machine) to host your WCF service. But as long as "localhost:8732" is up and running (you should have an icon in your system tray if it is), then the way you are accessing it should work just fine.

To be sure that you have the right address, you can start running / debugging your WCF service, and it should open a browser window pointing to the right URL.

GendoIkari
+1  A: 

Not sure but maybe this post can help you. Specially this part:

Generally, for client application that need to call WCF service, we first create the client service proxy class through VS Add ServiceReference or svcutil.exe, then using the generated proxy class to invoke service operations. And when creating the service proxy classes, the tool will also add configuration entries for the WCF service and endpoints in app.config file. If you are generating the service proxy in a class library project(not winform or console that will output executable image), you need to manually merge the app.config content into the actual application's app.config(in which you will reference the class library that contains the WCF service proxy).

Kamyar
Dang... That doesn't sound real easy. However I did learn about the ServiceReference part... Are there any examples out there for calling real simple WCF's from jQuery?
Jeff V
You can find some good info at http://www.c-sharpcorner.com/UploadFile/sridhar_subra/116/Default.aspx. Also I have written a simple JQuery plug-in which serializes your parameters (JSON) when you're calling ajax methods from JQuery (including WCF calls). you can download it from: http://www.4shared.com/file/Y72VBeLc/PageMethod.html
Kamyar
Also take a look at following posts: http://iainjmitchell.com/blog/?p=97 and http://iainjmitchell.com/blog/?p=142 and http://learningbyfailing.com/2008/05/calling-wcf-from-jquery-using-parameters/ and http://www.west-wind.com/weblog/posts/896411.aspx and http://yoavniran.wordpress.com/2009/08/02/creating-a-webservice-proxy-with-jquery/ and http://johnnliu.spaces.live.com/blog/cns!90A843AB92E99F!395.entry
Kamyar