.NET装错了集生成服务引用时, [英] .NET loading wrong assembly when generating service reference

查看:125
本文介绍了.NET装错了集生成服务引用时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了下面的错误,而试图添加服务引用到ASP.NET MVC 5 Web应用程序在Visual Studio 2012年我已经在我的项目引用Microsoft.Owin.Security版本3.0.0.0。如果我还添加了2.0.1.0版本?

I got the following error while trying to add service reference to a ASP.NET MVC 5 web application in Visual Studio 2012. I already have a reference to Microsoft.Owin.Security version 3.0.0.0 in my project. Should I also add for the 2.0.1.0 version?

Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Could not load file or assembly 'Microsoft.Owin.Security, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://tempuri.org/']/wsdl:portType[@name='IMyService']

这家伙<一个href="http://stackoverflow.com/questions/22985704/net-loaded-looking-for-another-version-of-assembly-when-generate-types-for-wcf/26762092#26762092">here也有类似的问题,但没有人回答。

This guy here had a similar issue but no one answered..

推荐答案

有完全相同的错误逐字,能够通过指定组件从重用类型来解决这个问题。

Had the exact same error verbatim and was able to resolve it by specifying which assemblies to reuse types from.

在添加服务引用,请点击高级... 添加服务引用窗口的左下角按钮。在服务参考设置显示,在数据类型部分,根据中引用的程序集在再利用类型的屏幕:复选框,选择在规定的基准程序集的再利用类型,然后单选按钮,只检查包含所使用的服务类型的组件。这应该可以解决这个问题。

When adding the service reference, click the Advanced... button in the bottom left corner of the Add Service Reference window. On the Service Reference Settings screen that appears, in the Data Type section, under the Reuse Types in referenced assemblies: check-box, select the Reuse types in specified reference assemblies radio button then check ONLY the assemblies that contain types used by the service. This should resolve the issue.

这篇关于.NET装错了集生成服务引用时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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