Я получаю исключение "Удаленный сервер возвратил неожиданный ответ: (400) неверный запрос", и я не имею ни малейшего понятия, почему.
Web.config выглядит нормально - но, возможно, я не вижу проблемы
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="524288" />
</system.web>
<system.serviceModel>
<services>
<service name="ServiceLibrary.ServiceProxy" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="wsHttpBinding" contract="ServiceLibrary.IServiceProxy">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
Код (сервер)
[ServiceContract]
public interface IServiceProxy
{
[OperationContract]
ImageData GetImgInfo( byte[] analyzingTargetBitmap );
}
[DataContract]
public class ImageData { ... }
Код клиента
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IServiceProxy" closeTimeout="00:15:00"
openTimeout="00:15:00" receiveTimeout="00:10:00" sendTimeout="00:15:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:15:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:50025/ServiceProxy.svc" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IServiceProxy" contract="ServiceReference1.IServiceProxy"
name="WSHttpBinding_IServiceProxy">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>