tags:

views:

774

answers:

4

I'm working with WCF (VS2005, .Net 3.0) and want to test out a service by directly calling it via a web browser instead of from code.

I have one method decorated with the OperationContract attribute call GetTest(). I have the service behind a .svc file that I can access; however, when I go .../Test.svc/GetTest, only a blank screen comes up.

Here is the web.config:

<system.serviceModel>
  <services>
    <service name="TestService" behaviorConfiguration="TestBehavior">
      <endpoint
        address=""
        binding="basicHttpBinding"
        contract="TestService.ITestService"></endpoint>
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="TestBehavior">
        <serviceMetadata httpGetEnabled="true"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>

Whenever I try to set a breakpoint in the service, it does not get hit as well. Any ideas on where I'm going wrong here? I'm used to ASMX services where I get a response when I access the methods via a browser; however, I can only get the "You've created a Service" page when I access the service but nothing from the methods.

A: 

Have you tried using SoapUI? They provide a really great Web Services Testing tool. They even have a free version that will run as a webStart!

Also, try installing a mex endpoint, c.f. msdn link.

Lucas B
+4  A: 

Consider using the Wcf Service Test Tool for initial testing of your service (but really- unit testing is your friend :-)) (and yeah - you will need a mex endpoint, at least initially)

As for debugging - are you attached to the correct process hosting the service? are you compiled with debug symbols? if the service is published to IIS - is the published code the same as the code in visual studio?

Yossi Dahan
I wish I could use the WCFTestClient.exe; however, the environment I'm in restricts me to only .net 3.0 (VS2005) only. Since WCFTestClient.exe appears if it only came with VS2008, I think I'm out of luck on that one.
JamesEggers
A: 

WCF does not offer the "call it from the web" options that ASMX services used to do. Why? It's a huge security hole, and not the best way to test a web service.

One option is to do as @Yossi suggested, and use the Wcf Service Test Tool.

Or better yet, write your own client to consume your web service. This will help you deal with the same issues those who will consume your service will deal with, and believe me, WCF can have quite a few of those hangups.

Don't get me wrong, WCF is frikkin awesome! But there's a lot to juggle, and if you're new odds are you're going to get it wrong. Even early adopters still don't know all the ins and outs of WCF.

Randolpho
This tool is indispensable when testing WCF services. Check out, http://www.wcfstorm.com. It can actually inspect your WSDl and allow you to dynamically invoke the methods
A: 

Take a look at WebGetAttribute - which needs .NET 3.5.

This allows you to get REST data from a WCF web service.

Joe
I am unable to use .net 3.5 on the project I'm working on. Has to be .net 3.0 instead sadly.
JamesEggers