tags:

views:

129

answers:

3

Hi!

I am writing web service and I have two classes:

<%@ 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)
        {
        }
    {
}

and Database.cs:

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

namespace CairoParts.ProductsInfoWS
{ 
   public class Database
    {  
    }
 }

When i fire xsp2 and type in browser http://localhost:8081/ProductsInfoWS.asmx i get this error:

/usr/lib/mono/2.0/gmcs.exe:22858): WARNING **: The following assembly referenced from /tmp/vadmin-temp-aspnet-0/b8083b1b/assembly/shadow/94001eba/43c949ff_d7c95745_00000001/CairoParts.ProductsInfoWS.dll could not be loaded: Assembly: Npgsql (assemblyref_index=2) Version: 2.0.6.0 Public Key: 5d8b90d52f46fda7 The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/tmp/vadmin-temp-aspnet-0/b8083b1b/assembly/shadow/94001eba/43c949ff_d7c95745_00000001).

My Npgsql.dll file is in 'bin' directory. Whats wrong...

A: 

It could be that the dll Npgsql.dll is strong-name signed and therefore needs to be placed in the global assembly cache (GAC), have you tried copying the dll into the location where the GAC is?

Hope this helps, Best regards, Tom.

tommieb75
A: 

Run:

monodis --assembly bin/Npgsql.dll

to verify that your assembly has the same version and public key that is referenced from CairoParts.ProductsInfoWS.dll.

In my local Mono installation compiled from sources, I have 3 directories in the gac for Npgsql:

1.0.5000.0__5d8b90d52f46fda7
2.0.0.0__5d8b90d52f46fda7
4.0.0.0__5d8b90d52f46fda7

and none of them has version 2.0.6.0.

Perhaps you need to recompile CairoParts.ProductsInfoWS.dll so that it references the assemblies present in your system.

Gonzalo
A: 

Hi Gonzalo,

I recompiled my project and run command that you have suggested, here's the output:

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:

It's look like npgsql versions are ok, but webservice still yields the same error.

I kinda solve this issue by putting Database class in webservice asmx file, but it's more like workaround then a real solution...

Adrian Serafin