How to call WCF services through your browser (Firefox)?

I just want to know how to call WCF service through the browser (Firefox)?

My WCF service looks like this:

http://localhost:4249/TestService.svc

I tried this:

[ServiceContract]
public interface ITestService
{
[OperationContract]
[WebGet(UriTemplate = "/GetAllPersons", ResponseFormat = WebMessageFormat.Xml)]
List GetAllPersons();


public class TestService: ITestService
{
public List GetAllPersons()
{
return Employees.CreateEmployees();
}

I tried this in the address bar of the browser:< /p>

http://localhost:4249/TestService/GetAllPersons

However, I have the following error:

< blockquote>

Server Error in’/’ Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make
sure that it is spelled correctly.

Requested URL: /TestService/GetAllPersons

What did I do wrong?

This is my web.config file, you can view:




















< assemblies>








< br />






























< br />






< br />



< serviceBehaviors>









< /pre>
In addition to the factory changes mentioned in the comment above, webHttpBinding needs to be enabled in web.config .Use this as a template to copy the contract and name details from the existing web.config:




















bindingConfiguration="WHB" contract="" />

< /services>

I just want to know how to call WCF services through the browser (Firefox)?

My WCF service looks like this:

http://localhost:4249/TestService.svc

I tried this:

[ServiceContract]
public interface ITestService
{
[OperationContract]
[WebGet(UriTemplate = "/GetAllPersons", ResponseFormat = WebMessageFormat.Xml)]
List GetAllPersons();


public class TestService: ITestService
{
public List GetAllPersons()
{
return Employees.CreateEmployees();
}

I tried this in the address bar of the browser:< /p>

http://localhost:4249/TestService/GetAllPersons

However, I have the following error:

< blockquote>

Server Error in'/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make
sure that it is spelled correctly.

Requested URL: /TestServ ice/GetAllPersons

What did I do wrong?

This is my web.config file, you can view:




























































< br />






< br />



< serviceBehaviors>









< /pre>

In addition to the factory changes mentioned in the comments above, you also need to enable webHttpBinding in web.config. Use this as a template, from the existing web. config copy contract and name details:


















< br />
bindingConfiguration="WHB" contract="" />

Leave a Comment

Your email address will not be published.