gpt4 book ai didi

wcf - 远程服务器返回意外响应 : (400) Bad Request

转载 作者:行者123 更新时间:2023-12-04 06:33:59 29 4
gpt4 key购买 nike

我收到异常“远程服务器返回意外响应:(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>

最佳答案

WCF 错误确实不能解释问题,但我遇到了类似的问题。可能是您发送的对象太大或数组中的项目太多。

您必须更改配置以接受更大的消息。

关于wcf - 远程服务器返回意外响应 : (400) Bad Request,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5056514/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com