wcf REST Ping timeout -
i have set iis authentification = basic, , create account windows login = pda , password = xxx.
but when client acces service, got message timeout
public stream pingserver() { //string leurl = "http://localhost:81/code/wcfservice_rest_suivicolis/wcfservice_rest_suivicolis/service1.svc"; string leurl = "http://xxx.yyy.zzz/fa85/service1.svc/"; string result = "",errpb=""; try { var myrequest = (httpwebrequest)webrequest.create(leurl); myrequest.credentials = new system.net.networkcredential("pda", "xxx"); myrequest.method = "put"; myrequest.contentlength = 0; var response = (httpwebresponse)myrequest.getresponse(); if (response.statuscode == httpstatuscode.ok) { // si le serveur ok result = "ok - " + datetime.now.tostring("yyyy/mm/dd hh:mm:ss"); } else { // sinon on le problem result = "ko - " + datetime.now.tostring("yyyy/mm/dd hh:mm:ss"); errpb = response.statusdescription + system.environment.newline; } } catch (exception ex) { // encore un autre problem result = "ko - " + datetime.now.tostring("yyyy/mm/dd hh:mm:ss"); errpb += ex.message + system.environment.newline; }
when deleted code:
myrequest.credentials = new system.net.networkcredential("pda", "xxx"); myrequest.method = "put";
i got error 401 : authentification failed
when deleted code :
myrequest.contentlength = 0;
i got error 411 : length required.
but now, got timeout delayed had expired
and web.config:
<services> <service name="wcfservice_rest_suivicolis.service1" > <endpoint address="" binding="webhttpbinding" contract="wcfservice_rest_suivicolis.iservice1" bindingconfiguration="basichttpendpointbinding" /> </service> </services> <behaviors> <servicebehaviors> <behavior name="servicebehaviour"> <servicemetadata httpgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true" /> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="web"> <datacontractserializer maxitemsinobjectgraph="2147483647" /> </behavior> </endpointbehaviors> </behaviors> <bindings> <webhttpbinding> <binding name="basichttpendpointbinding" maxreceivedmessagesize="2147483647" maxbuffersize="2147483647" receivetimeout="00:10:00" sendtimeout="00:10:00" opentimeout="00:10:00" closetimeout="00:10:00"> <security mode="transportcredentialonly" > <transport clientcredentialtype="basic" /> </security> </binding> </webhttpbinding> </bindings> <servicehostingenvironment multiplesitebindingsenabled="false" aspnetcompatibilityenabled="true"> <serviceactivations> <add factory="system.servicemodel.activation.webservicehostfactory" relativeaddress="service1.svc" service="wcfservice_rest_suivicolis.service1" /> </serviceactivations> </servicehostingenvironment>
it looks using windows account against basic authentication. should set iis authentication windows auth.
Comments
Post a Comment