When I create a new WCF service, I can create a new method like this one:
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "TryThis", ResponseFormat = WebMessageFormat.Json)]
string TryThis();
A function that returns a simple string.
I can use it with the test client WCF and that works. But when I want access to my service with Chrome, postman, or my Android application, I can't.
I tried with theses urls :
http://localhost:54792/Service1.svc/TryThis
http://tempuri.org/IService1/TryThis
When I use 'http://localhost:54792/Service1.svc' I have the home page, so this is ok. But I don't have access at any method of my service.
The error is a 400 error. but I don't have any message who indicate where this error is. I don't know if this is the configuration of my IIS server, if this is my service. I'm totally blocked.
This is my web.config
:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.7.1" />
<httpRuntime targetFramework="4.7.1"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
PS: I already saw this post : "How Can I access WCF services using a Web Reference?" but that didn't help me.