Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- An unhandled exception of type 'System.Net.WebException' occurred in System.dll
- Additional information: The remote server returned an error: (400) Bad Request.
- <?xml version="1.0"?>
- <configuration>
- <system.web>
- <compilation debug="true" targetFramework="4.5" />
- <httpRuntime targetFramework="4.5"/>
- </system.web>
- <system.serviceModel>
- <behaviors>
- <serviceBehaviors>
- <behavior>
- <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
- <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
- <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
- <serviceDebug includeExceptionDetailInFaults="false"/>
- </behavior>
- </serviceBehaviors>
- </behaviors>
- <services>
- <service name="WcfService1.Service1">
- <endpoint address="Soap" binding="basicHttpBinding" contract="WcfService1.IService1" />
- <endpoint address="Http" kind="webHttpEndpoint" contract="WcfService1.IService1" />
- <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
- </service>
- </services>
- <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
- </system.serviceModel>
- <system.webServer>
- <modules runAllManagedModulesForAllRequests="true"/>
- <httpErrors errorMode="Detailed"/>
- </system.webServer>
- </configuration>
- [ServiceContract]
- public interface IService1
- {
- [OperationContract]
- [WebInvoke]
- string GetData(string channel);
- }
- private static string HttpPost(string _postData)
- {
- using (WebClient webClient = new WebClient())
- {
- webClient.BaseAddress = "http://localhost:62147/Service1.svc/Soap/";
- webClient.Headers.Add("Content-Type", "text/xml; charset=utf-8");
- webClient.Headers.Add("SOAPAction", "http://tempuri.org/IService1/GetData");
- byte[] response = webClient.UploadData("GetData", Encoding.UTF8.GetBytes(_postData));
- return Encoding.UTF8.GetString(response);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement