1

I created a WCF service that returns a line of text and using a client application tested it and was able to retrieve the line of text. I thought that if I put the entire url in a browser that includes the method that returns the line of text it would work but instead I get a 400 not found error. For example the main url is :

http://localhost/DataAdmin/GService.svc?wsdl

So when I try to past the following in a browser it does not work:

http://localhost/DataAdmin/GService.svc/RetrieveData?inputText=test

Oh, the reason for this is that I am trying to test it remotely. I want an app to be able to call the service from another server/domain. I'm thinking it has something perhaps to do with the config files. Here is the config file of my service project.

<?xml version="1.0"?>
<configuration>

<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
 <behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

</configuration>
vbNewbie
  • 3,291
  • 15
  • 71
  • 155

1 Answers1

2

It is not as simple as that. WCF works with the SOAP protocol, you can't 'just' pass the method name and the value in the Url.

You can use a Restfull-API, I am referring you to this awsome post that tells all about it in a simple and concise manner.

Community
  • 1
  • 1
Vitaliy
  • 8,044
  • 7
  • 38
  • 66