WCF 教程出现错误 400(错误请求)? [英] Error 400 (Bad Request) with WCF Tutorial?

查看:36
本文介绍了WCF 教程出现错误 400(错误请求)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我昨晚开始使用 WCF 来设置一个简单的客户端服务器,它允许我在会话开始时向客户端发送游戏信息.

我遵循了 WCF 上的 microsoft 教程,并使用 VS2008 WcfSerivce"模板开始并添加了我的方法.然后我将它给我的地址复制并粘贴到我的客户端项目中的服务引用对话框中,并添加了从服务器获取数据的代码.然而现在的问题是,无论我请求数据时总是返回错误 400.

我在谷歌上搜索了这个错误,发现很多人都遇到了超出某个消息大小限制的问题,但即使该方法只返回一个字符,我也会收到这个错误.

我唯一能想到的就是 URI 或命名空间地址错误,它们应该是什么值?谢谢

这是我在服务和客户端中使用的代码,我不确定发布大量文本的规则是什么,所以我把它放在 Pastebin 上,但如果这里允许,我会再次编辑

http://pastebin.ca/1401443

解决方案

如果其他人遇到/遇到此问题,这是 Windows 7 兼容性问题.我在 RTM 上试过,它有效.

I began using WCF last night to setup a simple client server that will allow me to send game information to the client at the beginning of a session.

I followed the microsoft tutorial on WCF and used the VS2008 "WcfSerivce" template to begin and added my methods. I then copied and pasted the address it gives me into the service reference dialog in my client project and added the code to get data from the server. However the problem is now, no matter what it always returns error 400 when I request data.

I googled this error and found many people had a problem with a certain message size limit was exceeded, but I get this error even when the method only returns a single character.

The only thing I can think of is that the URI or namespace address is wrong, what value should they be instead? Thanks

EDIT: Here is the code I am using in the service and client, I'm not sure what the rule on post huge amounts of text so I put it on Pastebin, but if its allowed here I will edit again

http://pastebin.ca/1401443

解决方案

In case anyone else had/has this problem, it is a Windows 7 compatibility issue. I tried on the RTM, and it works.

这篇关于WCF 教程出现错误 400(错误请求)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆