I have an WCF API that is working on IIS when called by a Windows application using web SeviceReference. I am not trying to get it work when called by an Android application. I would assume I could "test" the otherwise working API from a web browser, or from Fiddler, to make sure my calling syntax was correct, but when I try, I get a 404 error.
My Webservice Web.config serviceModel is as follows:
<system.serviceModel>
<protocolMapping>
<add scheme="http" binding="basicHttpBinding"/>
</protocolMapping>
<services>
<service name="TaskTrackerAppService.Service1" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="basicHttpBinding" contract="TaskTrackerAppService.IAppWebService"></endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" bindingConfiguration=""></endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
When I enter into a browser:
http://localhost:51276/AppWebService.svc and
http://localhost:51276/AppWebService.svc?wsdl
I do get the expected WSDL response. (From both my localhost and from the hosted web server where this WCF has been running.)
So next I add in the request for:
http://localhost:51276/AppWebService.svc/SayHello/1000
Where SayHello will return confirmation that userId 1000 exists. And I get back:
404 - The resource cannot be found
I've also tried:
http://localhost:51276/AppWebService.svc/SayHello?userId=1000 etc.
Help. I'm stuck. Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…