Web服务和应用程序依赖项引用之间的名称空间差异 [英] namespace differences between web service and application dependency references

查看:113
本文介绍了Web服务和应用程序依赖项引用之间的名称空间差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个都引用AppTypes.dll程序集的应用程序.一个应用程序是普通的winforms应用程序,另一个应用程序是Web服务.

I've got 2 applications that both reference a AppTypes.dll assembly. One app is normal winforms app and the other is a web service.

我正在将AppTypes中定义的对象传递给我的Web服务,但是却出现命名冲突,因为显然,Web服务在将服务添加到我的项目后也定义了那些类型.我有什么办法可以解决它或解决VS带来的困惑,或者这是正常现象吗?

I'm passing an object defined in AppTypes to my web service but I get naming conflicts because apparently the web service also defines those types after adding the service to my project. Is there any way that I can fix it or resolve the confusion that VS is having or is this normal?

推荐答案

使用Web服务代理,可以在添加Web引用时或通过wsdl.exe /namespace选择名称空间.但是,这些将是单独的类型,您不能将两者视为相同.这通常会引起很多混乱...

With the web-service proxies, you can choose the namespace when you add the web-reference, or via wsdl.exe /namespace. However, these will be separate types and you can't treat the two as the same. This often causes a lot of confusion...

如果要共享类型,请考虑使用WCF而不是2.0样式的Web服务,这可以通过IDE和svcutil.exe /reference

If you want to share the types, consider using WCF instead of 2.0-style web-services, which allows this - both via the IDE, and via svcutil.exe /reference

这篇关于Web服务和应用程序依赖项引用之间的名称空间差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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