Может кто-нибудь объяснить мне, почему я получаю ошибку http 400 при попытке опубликовать в моем веб-сервисе?
Мой сервисный контракт ::
[ServiceContract]
public interface IfldtWholesaleService {
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "MAC")]
string MAC(string input);
Мой звонок;
private void postToWebsite()
{
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(txtUrl.Text);
req.Method = "POST";
req.MediaType = "text/xml";
string input = "dfwa";
req.ContentLength = ASCIIEncoding.UTF8.GetByteCount(input);
StreamWriter writer = new StreamWriter(req.GetRequestStream());
writer.Write(input);
writer.Close();
var rsp = req.GetResponse().GetResponseStream();
txtOut.Text = new StreamReader(rsp).ReadToEnd();
}
Файл конфигурации моего сервера
<system.serviceModel>
<services>
<service name="fldtRESTWebservice.fldtWholesaleService" behaviorConfiguration="httpBehaviour">
<endpoint address="" binding="webHttpBinding" contract="fldtRESTWebservice.IfldtWholesaleService" behaviorConfiguration="httpEndpointBehavour">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/ContactService/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="httpBehaviour">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="httpEndpointBehavour">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
EDIT :: также выдает ту же ошибку при использовании MediaType "text / plain"