简体   繁体   English

更新WCF服务对VS 2010中WebService问题的引用

[英]Update WCF service reference to WebService issue in VS 2010

My current project is using VS 2010. I'm new to WCF. 我当前的项目是使用VS2010。我是WCF的新手。 I've consumed WebServices before but I've never had to generate the actual proxy. 我以前使用过WebServices,但是我从来不需要生成实际的代理。 The current project I'm working on using WCF service reference to call a web service. 我正在使用WCF服务参考来调用Web服务的当前项目。 Fairly simple and straightforward. 非常简单明了。 I've added a new service reference and everything worked perfectly on the initial setup. 我添加了一个新的服务参考,并且在初始设置中一切正常。

When the WSDL was updated, I simply right-clicked on the service reference and selected "Update Reference". 在更新WSDL时,我只需右键单击服务引用并选择“更新引用”。 After doing so, there are now duplicate object names with the number '1' appened. 这样做之后,现在将出现重复的对象名称,并带有数字“ 1”。 So for example: 因此,例如:

Initial generate from WSDL results: 根据WSDL结果初步生成:

GetWidget (getWidgetRequest)
GetWidgets (getWidgetRequest)
GetWidgetGroups (getWidgetRequest)

After updating, I now have this: 更新后,我现在有了这个:

GetWidget (getWidgetRequest)
GetWidgets (getWidgetRequest)
GetWidgetGroups (getWidgetRequest)

GetWidget1 (getWidgetRequest1)
GetWidgets1 (getWidgetRequest1)
GetWidgetGroups1 (getWidgetRequest1)

So now I have to use the GetWidget1 method to use the "updated" service method. 所以现在我必须使用GetWidget1方法来使用“更新的”服务方法。 My questions are: 我的问题是:

  1. Is there a way to overwrite the previous methods without generating new types to accomodate the update? 有没有一种方法可以覆盖以前的方法而无需生成新的类型来适应更新?
  2. Do I have to manually clean this up every time the WSDL is updated? 每次更新WSDL ,我都必须手动清理吗?
  3. Am I updating the service reference incorrectly? 我是否错误地更新了服务参考? Do I need to use the svcutil.exe? 我需要使用svcutil.exe吗?

I found 4 files within the service reference ending in .datasource. 我在.datasource结尾的服务参考中找到4个文件。 They all have the new typename (GetWidget1.datasource, GetWidgetGroups1.datasource, etc.). 它们都具有新的类型名(GetWidget1.datasource,GetWidgetGroups1.datasource等)。 Below is a sample of the contents of the file: 以下是文件内容的样本:

<GenericObjectDataSource DisplayName="GetWidget1" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
   <TypeInfo>GetWidget1, Service References.WidgetService.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

We're using Visual Studio 2010 version 10.0.40219.1 SP1Rel 我们正在使用Visual Studio 2010版本10.0.40219.1 SP1Rel

You're using vs 2010? 您正在使用vs 2010?

This was a bug in older versions but was fixed in 2010 - see here 这是旧版本中的错误,但已在2010年修复-参见此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM