自动生成与 asmx.cs Web 方法相关的代码
我们收到一个包含asmx.cs文件的VS2010解决方案,该文件包含WebMethods。我想向此文件添加一个新的 WebMethod。我复制并重命名了现有方法,但无法访问它。
在搜索与现有方法相同的名称时,我在 Reference.cs 文件和 .wsdl 文件中发现了自动生成的代码。我不明白这段代码是如何生成的,这是类向导的结果还是类似的结果?
We received a VS2010 solution containing an asmx.cs file, this file contains WebMethods. I would like to add a new WebMethod to this file. I copied and renamed an existing method but I cannot access it.
Searching for names identical to the existing methods I found auto-generated code inside a Reference.cs file and a .wsdl file. I don't understand how this code was generated, is this the result of a class wizard or something similar?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请阅读添加和删除 Web 引用 MSDN 上的文章。您已修改服务,为了反映客户端项目中的更改,您将需要更新服务的引用。
刷新网络参考
这将使用其 .WSDL 描述文件的最新副本重新生成 Web 服务的代理类。刷新的代理中列出的任何方法都应该可以从当前版本的 Web 服务中获得。
正如您提到的,您更改了函数名称,您的构建可能会在客户端项目中中断。
Please read Adding and Removing Web References article on MSDN. You have modified the service, to reflect the changes in client project you will need to update the reference of the service.
To refresh a Web reference
This will regenerate the proxy class for the Web service, using the latest copy of its .WSDL description file. Any methods listed in the refreshed proxy should be available from the current version of the Web service.
As you mentioned that you changed the name of function, your build might break in the client project.