将Web服务引用添加到项目时,扫描部件中的类型时出错

时间:2018-07-26 08:26:57

标签: c# web-services reflection

我有此代码:

public void Initialize()
    {
        if (Configuration["Integration:Client:" + OrdersIntegrationConstants.ExternalLoadFieldsType] != null && !String.IsNullOrEmpty(Configuration["Integration:Client:" + OrdersIntegrationConstants.ExternalLoadFieldsType].ToString()))
        {
            var kk1 = Configuration["Integration:Client:" + OrdersIntegrationConstants.ProjectDirectory].ToString();
            var kk2 = Assembly.LoadFrom(kk1);

            Type[] typesInAsm;
            try
            {
                typesInAsm = kk2.GetTypes();

                var kk4 = typesInAsm.ToList();

            }
            catch (ReflectionTypeLoadException ex)
            {
                typesInAsm = ex.Types;
            }

        }
    } 

在(DLL的)项目中添加对Windowsservice(asmx)的引用时,出现文本错误:无法加载一种或多种请求的类型。检索LoaderExceptions属性以获取更多信息。:

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

当我删除对Web服务的引用时,它可以正常工作: enter image description here

0 个答案:

没有答案