繁体   English   中英

mono,xsp2,npgsql无法加载程序集

[英]mono, xsp2, npgsql Could not load assembly

我正在编写Web服务,并且有两节课:

<%@ WebService Language="C#" Class="CairoParts.ProductsInfoWS.ProductsInfoWS.cs" %>

using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

namespace CairoParts.ProductsInfoWS
{    
    [WebService(Namespace = "http://localhost:8081/ProductsInfoWS")]     
    public class ProductsInfoWS : System.Web.Services.WebService
    {        
        [WebMethod]
        public List<string> ReceiveFile(byte[] bytes, string fileName, string supplier)
        {
        }
    {
}

和Database.cs:

using System;
using System.Data;
using System.Configuration;
using Npgsql;

namespace CairoParts.ProductsInfoWS
{ 
   public class Database
    {  
    }
 }

当我启动xsp2并在浏览器中输入http:// localhost:8081 / ProductsInfoWS.asmx时,出现此错误:

/usr/lib/mono/2.0/gmcs.exe:22858):警告**:从/tmp/vadmin-temp-aspnet-0/b8083b1b/assembly/shadow/94001eba/43c949ff_d7c95745_00000001/CairoParts.ProductsInfoWS中引用了以下程序集。无法加载dll:程序集:Npgsql(assemblyref_index = 2)版本:2.0.6.0公钥:5d8b90d52f46fda7在全局程序集缓存,MONO_PATH环境变量中列出的路径或执行位置中找不到程序集程序集(/ tmp / vadmin-temp-aspnet-0 / b8083b1b / assembly / shadow / 94001eba / 43c949ff_d7c95745_00000001)。

我的Npgsql.dll文件位于“ bin”目录中。 怎么了...

dll Npgsql.dll可能是强名称签名的,因此需要放置在全局程序集缓存(GAC)中,您是否尝试过将dll复制到GAC所在的位置?

希望这对您有所帮助,汤姆,谢谢。

跑:

monodis --assembly bin/Npgsql.dll

验证程序集具有与CairoParts.ProductsInfoWS.dll引用的版本和公用密钥相同的版本。

在从源代码编译的本地Mono安装中,我在gac中有3个用于Npgsql的目录:

1.0.5000.0__5d8b90d52f46fda7
2.0.0.0__5d8b90d52f46fda7
4.0.0.0__5d8b90d52f46fda7

它们都没有2.0.6.0版。

也许您需要重新编译CairoParts.ProductsInfoWS.dll,以便它引用系统中存在的程序集。

我重新编译了我的项目并运行您建议的命令,这是输出:

Assembly Table
Name:          Npgsql
Hash Algoritm: 0x00008004
Version:       2.0.6.0
Flags:         0x00000001
PublicKey:     BlobPtr (0x000020b1)
Dump:
0x00000000: 00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 
0x00000010: 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 
0x00000020: 2B 3C 59 0B 2A 4E 3D 34 7E 68 78 DC 0F F4 D2 1E 
0x00000030: B0 56 A5 04 20 25 0C 66 17 04 43 30 70 1D 35 C9 
0x00000040: 80 78 A5 DF 97 A6 2D 83 C9 A2 DB 2D 07 25 23 A8 
0x00000050: FC 49 13 98 25 4C 6B 89 32 9B 8C 1D CE F4 3A 1E 
0x00000060: 7A A1 61 53 BC EA 2A E9 A4 71 14 56 24 82 6F 60 
0x00000070: D7 C8 E7 1C D0 25 B5 54 A0 17 7B D9 35 A7 80 96 
0x00000080: 29 F0 A7 AF C7 78 EB B4 AD 03 3E 1B F5 12 C1 A9 
0x00000090: C6 CE EA 26 B0 77 BC 46 CA C9 38 00 43 5E 77 EE 
Culture:       

看起来npgsql版本还可以,但是网络服务仍然会产生相同的错误。

我通过将Database类放在webservice asmx文件中来解决此问题,但这更像是一种解决方法,然后是一个真正的解决方案...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM