更新服务参考导致参数类型不匹配 [英] Update Service Reference causes parameter type mismatch

查看:82
本文介绍了更新服务参考导致参数类型不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我目前正在研究与WCF Web服务通信的完全信任XBAP.我正在使用Visual Studio 2008和.NET Framework 3.5.

有一天,我在XBAP和WCF服务都引用的库中创建了一个新的枚举类型.当我在对Web服务的方法调用中使用该枚举类型作为参数并单击更新服务引用"时,我由于参数类型不匹配而导致很多错误.

第一个问题是我的枚举类型被同时引用为WebServiceName.EnumeratedType和XBAPName.EnumeratedType.做完一些研究后,我尝试右键单击ServiceReference->配置服务参考->在引用的程序集中重用类型,并确保已选中此选项. las,这并不能解决我的问题.

除了枚举导致参数类型不匹配之外,以前可以正常使用的参数也开始被淘汰.例如,我先前成功地将Guid用作参数,但是在添加枚举类型"Update Service Reference"之后,我将其作为参数使用.开始转换"System.Guid"

我可以通过执行搜索&手动修复错误.替换不匹配的参数类型,但这是一个巨大的痛苦.

有没有人知道在更新服务参考"期间有多少个参数类型会被抛出?

谢谢.

Rich

Hey all, I'm currently working on a full trust XBAP that communicates with a WCF Web Service. I'm using Visual Studio 2008 and .NET Framework 3.5.

One day I created a new enumerated type in a library referenced by both the XBAP and the WCF service. When I used that enumerated type as a parameter in method calls to the web service and clicked "Update Service Reference" I got a lot of errors caused by parameter types being mismatched.

The first problem is that my enumerated type is being reffered to both as WebServiceName.EnumeratedType and XBAPName.EnumeratedType. After doing some research I tried right-clicking the ServiceReference -> Configure Service Reference -> Reuse Types in Referenced Assemblies and ensured this was checked. Alas, this didn't solve my problem.

In addition to the enumerated causing parameter type mismatchers, parameters that previous worked fine started being thrown out of whack. For example, I previously used a Guid as a parameter successully, but after adding my enumerated type "Update Service Reference" started converting "System.Guid" to "string".

I can fix the errors manually by doing a search & replace for the parameter types that become mismatched, but this is a huge pain.

Does anyone out there know what could so many parameter types to get thrown out of whack during an "Update Service Reference"?

Thanks.

Rich

推荐答案

第一个问题是我的枚举类型被同时引用为WebServiceName.EnumeratedType.和XBAPName.EnumeratedType.做完一些研究后,我尝试右键单击ServiceReference->配置服务参考->在引用的程序集中重用类型,并确保已选中此选项. las,这不能解决我的问题.
The first problem is that my enumerated type is being reffered to both as WebServiceName.EnumeratedType and XBAPName.EnumeratedType. After doing some research I tried right-clicking the ServiceReference -> Configure Service Reference -> Reuse Types in Referenced Assemblies and ensured this was checked. Alas, this didn't solve my problem.


这很奇怪.当您使用重用类型"时,甚至应该没有"XBAPName.EnumartedType".完全由服务配置工具创建.如果在其余的代码中使用了该类型,则现在应该得到一个"XBAPName.EnumartedType类型不存在".错误或类似的内容.一旦遇到该错误,就可以将类型更改为重用类型.是的,这可能意味着要进行大量查找/替换.


This is very odd. When you use "Reuse Type", there should not even be a "XBAPName.EnumartedType" created by the Service Configuration Tool at all. If you've used that type in the rest of your code, you should now be getting a "XBAPName.EnumartedType Type does not exist" error or something similar instead. Once you have that error, then you can change your types to the reused type. Yes, that may mean a whole lot of find/replaces.


这篇关于更新服务参考导致参数类型不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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