WCF REST 服务“意外的文件结尾”
我有一个 ASP.NET Web 应用程序,我使用 WCF REST 服务插入 500 条记录,但出现错误“意外的文件结尾”,我已将
<bindings>
<basicHttpBinding>
<!-- Create a custom binding for our service to enable sending large amount of data -->
<binding name="NewBinding0" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
客户端配置和服务配置都放入其中,但存在相同的问题...任何解决方案为了这
I have an ASP.NET web application where i am using WCF REST services to insert 500 reords but getting the error 'unexpected end of file' i have put
<bindings>
<basicHttpBinding>
<!-- Create a custom binding for our service to enable sending large amount of data -->
<binding name="NewBinding0" sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
in both client cofig and service config ,but the same issue exists...any solution for this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决方案可能是停下来搜索一些有关 WCF 和 REST 的文章,并至少了解您尝试使用的 API 的基本知识。
basicHttpBinding
适用于 SOAP 服务,不适用于 REST 服务。 REST 服务使用webHttpBinding
,因此很难说出您的应用程序中发生了什么,因为您的第一个语句与您的其余问题直接冲突。
Solution is probably to stop and search for some articles about WCF and REST and learn at least essentials of the API you are trying to use.
basicHttpBinding
is for SOAP services, not for REST services. REST services usewebHttpBinding
so it is hard to say what's going on in your application because your very first statementis in direct collision with the rest of your question.
Mrnka 是正确的,您应该使用 webHttpBinding 进行 REST。您的 web.config 文件应该包含以下内容:
Mrnka is correct, you should be using webHttpBinding for REST. Your web.config file should have this: