使用 slsvcutil.exe 引用共享 Silverlight 程序集

发布于 2024-09-25 00:39:28 字数 1242 浏览 0 评论 0原文

我有多个 WCF 服务被不同的 Silverlight 应用程序使用。我目前正在使用 slsvcutil.exe 和相当标准的设置来生成我的 Silverlight 代理对象:

"%ProgramFiles%\microsoft sdks\silverlight\v4.0\tools\slsvcutil.exe" http://myhost/MyService.svc?wsdl /out:Proxy.cs /edb /namespace:"*,My.Namespace" /ct:System.Collections.ObjectModel.ObservableCollection`1 /r:"%ProgramFiles%\Microsoft Silverlight\4.0.50524.0\System.Windows.dll"

我想做的是共享一些类型,特别是基本 多个服务及其生成的 Silverlight 代理之间的 RequestMessageResponseMessageApplicationFault。我希望这些类型位于它们自己的公共 Silverlight 命名空间中,以便我可以使用共享的 Silverlight 代码来轮询服务请求或检查 SOAP 错误并将其转换为可以引发的已知异常类型。

我认为这可以通过使用 slsvcutil.exe 上的 /r/reference 开关来完成,方法是指定具有共享类型的 DLL 的路径。我尝试像这样构建代理,但它似乎仍然为我试图共享的对象生成新的不兼容类型:

"%ProgramFiles%\microsoft sdks\silverlight\v4.0\tools\slsvcutil.exe" http://myhost/Service.svc?wsdl /out:Proxy.cs /edb /namespace:"*,My.Namespace" /ct:System.Collections.ObjectModel.ObservableCollection`1 /r:"%ProgramFiles%\Microsoft Silverlight\4.0.50524.0\System.Windows.dll" /r:"C:\path\to\MySharedTypes.dll"

关于可能出现问题的任何想法?或者我对 /r 开关与 slsvcutil.exe 的用途有什么错误的印象吗?

I have several WCF services being consumed by different Silverlight applications. I am currently using slsvcutil.exe with a pretty standard setup to generate my Silverlight proxy objects:

"%ProgramFiles%\microsoft sdks\silverlight\v4.0\tools\slsvcutil.exe" http://myhost/MyService.svc?wsdl /out:Proxy.cs /edb /namespace:"*,My.Namespace" /ct:System.Collections.ObjectModel.ObservableCollection`1 /r:"%ProgramFiles%\Microsoft Silverlight\4.0.50524.0\System.Windows.dll"

What I would like to do is share some types, specifically a base RequestMessage, ResponseMessage, and ApplicationFault between the multiple services and their generated Silverlight proxies. I would like these types to be in their own common Silverlight namespace so that I can use shared Silverlight code to do things poll a service request or check for a SOAP fault and translate it into a known exception type that can be thrown.

I thought that this could be done by using the /r or /reference switch on slsvcutil.exe by specifying the path to the DLL with the shared types. I tried building the proxy like this but it still seemed to be generating new incompatible types for the objects I was trying to share:

"%ProgramFiles%\microsoft sdks\silverlight\v4.0\tools\slsvcutil.exe" http://myhost/Service.svc?wsdl /out:Proxy.cs /edb /namespace:"*,My.Namespace" /ct:System.Collections.ObjectModel.ObservableCollection`1 /r:"%ProgramFiles%\Microsoft Silverlight\4.0.50524.0\System.Windows.dll" /r:"C:\path\to\MySharedTypes.dll"

Any ideas on what might be going wrong? Or do I have the wrong impression of what the /r switch can be used for with slsvcutil.exe?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文