变量/属性名称的字符数是否有限制?

发布于 2024-10-02 21:00:08 字数 454 浏览 4 评论 0原文

我必须道歉,这个问题没有完全解决我的问题。这是一个处理将 UDT 对象传递给 ac# webservice 的 C# 问题。客户端是一个Windows Mobile表单应用程序。

我目前有一个我个人定义的 UDT,并且现在添加了一个新成员(一个名为 SchedulerRecordCount 的变量,该属性名为 SchedulerRecordCount)。在添加这个新成员之前,我能够毫无问题地将这个对象的实例传递给 Web 服务方法。添加新成员后,我无法从我的网络方法获得响应。调用 webmethod 并传递对象后,我会收到一个异常,提示“无法从传输连接读取”。

我尝试了很多方法来排除故障,最后,我将变量名称缩短为 schedRecCnt,将属性缩短为 SchedRecCnt。这成功了。请注意,此 UDT 的所有其他成员都是 String 类型(以及我的新成员)。

有谁知道在 UDT 内部传递给 Web 方法时变量可以具有的字符数限制?

I have to apologize the question does not fully address my issue. This is a C# issue dealing with passing a UDT object to a c# webservice. The client end is a windows mobile forms application.

I currently have a UDT that I personally defined and have now added a new member to (a variable named schedulerRecordCount, the property is named SchedulerRecordCount). Before adding this new member I was able to pass an instance of this object to a web service method without issue. After adding the new member I was unable to get a response from my web method. After calling the webmethod and passing the object I would get an exception that says "unable to read from the transport connection".

I tried many things to trouble shoot, and in a last-ditch effort, I shorted the variable name to schedRecCnt and the property to SchedRecCnt. This did the trick. As a note, all of the other members of this UDT are of type String (as well as my new member).

Does anyone know of a limitation to the number of characters that a variable can have when being passed inside of a UDT to a web method?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

囚你心 2024-10-09 21:00:08

当然,标识符的长度有一定的限制,但您肯定还没有接近它。我不知道具体的限制,但大概1000个字符左右。

但是,您可能已达到返回消息的总大小限制。这与缩短属性名称的工作原理相符,因为这也会缩短消息的总长度。

在客户端 web.config 的 SOAP 绑定设置中,检查 MaxReceivedMessageSize 属性的值,并根据需要增加该值。

There is of course some limit to the length of identifiers, but you are certainly not even close to it. I don't know the exact limit, but perhaps 1000 characters or so.

You might however have reached the limit for the total size of the message that is returned. That would fit with how shortening the property name makes it work, as that would shorten the total length of the message also.

In the settings for the SOAP binding in web.config on the client, check the value of the MaxReceivedMessageSize property, and increase it if needed.

攀登最高峰 2024-10-09 21:00:08

C# 规范没有限制,但 Visual Studio IDE 将仅对

C# 中的 511 个字符和 VB.Net 中的 1023 个字符进行着色(将其他字符保留为黑色)。

There is no limit imposed by C# specs but Visual Studio IDE will colorize only

511 characters in C# and 1023 characters in VB.Net (leaving other characters black).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文