Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <system.serviceModel>
- <services>
- <service behaviorConfiguration="ServiceBehavior" name="TestAPI">
- <endpoint address="" behaviorConfiguration="RESTFriendly" binding="webHttpBinding" contract="ITestAPI" />
- <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
- </service>
- </services>
- <behaviors>
- <endpointBehaviors>
- <behavior name="RESTFriendly">
- <webHttp />
- </behavior>
- </endpointBehaviors>
- <serviceBehaviors>
- <behavior name="ServiceBehavior">
- <serviceMetadata httpGetEnabled="true" />
- <serviceDebug includeExceptionDetailInFaults="true" />
- </behavior>
- </serviceBehaviors>
- </behaviors>
- <appSettings>
- <add key="WEBSERVICE" value="URL"/>
- WebChannelFactory<ITestAPI> cf = new WebChannelFactory<IAPI>(baseAddress);
- WebHttpBinding wb =cf.Endpoint.Binding as WebHttpBinding;
- wb.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
- wb.Security.Mode = WebHttpSecurityMode.Transport;
- cf.Credentials.UserName.UserName = "usermane";
- cf.Credentials.UserName.Password = "password";
- ITestAPI channel = cf.CreateChannel();
- string msg = channel.TestMethod();
Add Comment
Please, Sign In to add comment