在C#中使用Web服务(dotnet) [英] Using a web service in C# (dotnet)

查看:70
本文介绍了在C#中使用Web服务(dotnet)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用网络服务.我已将其添加到引用中,并且我认为我的代码中具有正确的using语句-无论如何,它没有给我语法错误:
使用projectname.webServiceName
但是,当我尝试在代码中引用该服务时,IntelliSense无法识别它.即,当我输入 projectname.时,根本没有显示webServiceName.

我想念什么?

我将不胜感激.

另外,我来自大型机,后来又来自PC数据库领域,尽管我已经在dotnet/C#领域工作了几年,但我发现术语仍然无处不在.谁能为此推荐一个好的基本参考书/词典? (例如,方法的重载"一词太奇怪了.当我阅读它时,我开始对自己说变异",现在发现将这个概念包起来很容易.)

谢谢!

I''m trying to use a web service. I''ve added it to my references, and I think I have the correct using statement in my code - at any rate, it''s not giving me a syntax error:
using projectname.webServiceName
But when I try to reference the service in my code, IntelliSense does not recognize it. i.e. When I type projectname. I''m not shown webServiceName at all.

What am I missing?

I''d appreciate any help.

Also, I came from the mainframe and then pc database worlds, and though I''ve been working in the dotnet / C# world for a couple of years, I find that the terminology still gets me at every turn. Can anyone recommend a good basic reference / dictionary for this? (For example, the word "overload" for methods is so strange. I started saying "variation" to myself when I read it, and now find it so much easier to wrap my head around the concept.)

Thanks!

推荐答案

好,在解决方案资源管理器中尝试一下
1)在服务引用"节点下选择您的Web服务
2)单击解决方案资源管理器顶部的显示所有文件"(如果您不知道是哪个图标,则图标会显示工具提示)
3)扩展服务节点
4)展开Reference.svcmap
5)打开Reference.cs
6)现在,您将看到生成的代码,并且应该能够看到它位于哪个名称空间中.
Ok try this in the Solution Explorer
1) Select your webservice under the node "Service References"
2) Click "Show All Files" at the top of the Solution Explorer (The icons has tool tips if you don''t know which one it is)
3) Expand your service node
4) Expand Reference.svcmap
5) Open Reference.cs
6) Now you see the generated code and should be able to see which namespace it is in


有关术语,这里是一个链接: ^ ]

您可以通过搜索
For the terminology, here is a link: List of object-oriented programming terms[^]

You can find many more references by searching for object oriented terms[^]


是的,术语…

我想对此发表评论.我完全同意过载"这个词很奇怪.有些术语是这样的,这是最不幸的一个.没有加载",因此没有任何东西可以超载".最糟糕的是,该单词听起来与非常合理的术语"override"/"overridden"相似.

如此奇怪的事情发生了,以至于有人提出了一个最奇怪的想法,即重载提供了编译时的多态性,而重载则提供了运行时的多态性".我认为该陈述的第一部分是最愚蠢的,因为重载"与多态无关.它根本不引入任何功能.它只是建议简化语法,非常方便,因为为类似方法发明人为名称是一件坏事.它为编译器以及编写调用和阅读编译器错误消息的人员带来了某些额外的复杂性,但这仅是方法名称的便利性和可读性.这是言语如何影响思维的例子.不幸的是,这发生在人类身上.

这给出了关于不同名称来代替重载"的正确想法.首先,您的变体"一词只会稍微好一点.然后,重新命名这种东西为时已晚.我认为有更好的解决方案.此语法规则…完全不需要特殊术语.当编译器无法在方法名称不同的情况下可以解析方法名称的情况下,存在一个非常明显的问题.尝试解释一下;并且您会发现您实际上并不需要使用重载"一词或将其替换.

有几个不便或误导性的术语使对事物本质的理解更加模糊.另一个例子是比赛条件".我相信有太多开发人员甚至在阅读了有关该主题的某些文章或将其与死锁"(我会说相当好的术语)相混淆之后,仍从未理解过该概念.毕竟,如果线程彼此竞争"怎么办?当我第一次阅读竞赛条件"的概念时,它使用更具描述性的术语按执行顺序的不正确行为"进行了解释.

言语在现实生活中很重要.

—SA
Yes, terminology…

I want to comment on this concern. I absolutely agree that the term "overload" is very strange. Some terms are like that, this one is one of the most unfortunate. There is nothing "loaded", so nothing can be "overloaded". What''s worst, the word sounds similar to the very reasonable term "override"/"overridden".

Weird things went so far that somebody coined a most strange notion that "overloading provides compile-time polymorphism and overriding provides run-time polymorphism". I think first part of this statement is the most stupid thing because "overloading" have nothing to do with polymorphism; it does not introduce any functionality at all. It just suggests ease-up of the syntax, very convenient, because inventing artificial names for similar method is bad thing. It introduces certain extra complexity for the compiler and the people writing the calls and reading compiler error message, but this is nothing next to offered convenience and readability of method names. This is the example of how words affects thinking. Unfortunately, it happens to human beings.

That gives a right idea about different name to replace "overloading". First, your term "variation" is only marginally better. Then, it''s too late to rename such thing. I think there is a better solution. This syntax rule… does not need a special term at all. There is very clear problem with the cases when a compiler cannot resolve the method name in a situation when it could be resolved in case of different names. Try to explain this; and you will see that you don''t really need to use the term "overloaded" or a replacement of it.

There are several inconvenient or misleading terms which makes understanding of essence of things more obscured. Another example is "race condition". I believe there are too many developers who never understood the notion even after reading some articles on the topic or confuse it with "deadlock" (pretty good term I would say). After all, what''s wrong if threads "race" against each other? When I first read about the notion of "race condition", it was explained using much more descriptive term "incorrect behavior on the order of execution".

Words do matter, in real life.

—SA


这篇关于在C#中使用Web服务(dotnet)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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