使用 WPF CSLA 远程服务器时出现错误
我正在运行带有远程服务器设置的 WPF 应用程序,但收到“远程服务器返回意外响应:(400) 错误请求”。
这绝对是一个请求大小问题,因为我尝试减少发送的数据大小并且调用工作正常。 从我的配置来看,我似乎设置了 2 Gig,但它的行为就像只使用了默认限制(大约 65000 字节)。 我认为我的配置有问题。
任何帮助,将不胜感激!
标记。
我有一个使用 WCF web.config 设置的远程服务器:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBindingSettings" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="Csla.Server.Hosts.WcfPortal">
<endpoint contract="Csla.Server.Hosts.IWcfPortal" binding="wsHttpBinding"/>
</service>
</services>
我在客户端上的 app.config 是:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBindingSettings" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint name="WcfDataPortal" address="http://alcatraz.dev/AlcatrazHost/WcfPortal.svc" binding="wsHttpBinding" contract="Csla.Server.Hosts.IWcfPortal" bindingConfiguration="wsHttpBindingSettings" />
</client>
I am running a WPF app with a remote server setup but getting "The remote server returned an unexpected response: (400) Bad Request" .
This is definitely a request size issue since I tried reducing the data size being sent and the call worked fine. From my configuration it looks like I have 2 Gigs set up, but it behaves like only the default limit (something like 65000 bytes) is being used. I am thinking there is something wrong with my configuration.
Any help would be appreciated!
Mark.
I have a remote Server set up using WCF web.config:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBindingSettings" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="Csla.Server.Hosts.WcfPortal">
<endpoint contract="Csla.Server.Hosts.IWcfPortal" binding="wsHttpBinding"/>
</service>
</services>
And my app.config on the client is:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBindingSettings" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint name="WcfDataPortal" address="http://alcatraz.dev/AlcatrazHost/WcfPortal.svc" binding="wsHttpBinding" contract="Csla.Server.Hosts.IWcfPortal" bindingConfiguration="wsHttpBindingSettings" />
</client>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须在客户端和服务器上设置配额,而不仅仅是其中之一。
You have to set quotas on the client and the server, not just one.
也许是连接超时? 对于想要通过网络服务提交的数据来说,2GB 是一个巨大的数据量。
您可能需要寻找通过网络移动数据的替代方法,例如文件共享、SFTP 等。
Maybe a connection timeout? 2GB is a huge amount of data to want to submit via a web service.
You might want to look at alternative means to move the data across the network such as a file share, SFTP, etc.