[Mono-list] Error compiling webservice: An element with the same key already exists in the dictionary.

Andrus kobruleht2 at hot.ee
Sun Dec 14 17:42:35 EST 2008


I tried to run web service sample from silverlight.net samples

http://localhost/WebServicesApp_Web/SimpleAsmx.asmx

but got error below.
>From Visual Web Developer Express 2008 this service runs OK.

How to fix ?

Additional question:
How to return IList<Customer>  type from web service method call in MONO ?


Andrus.

-------- SimpleAsmx.asmx contains:

ļ»æ<%@ WebService Language="C#" CodeBehind="~/App_Code/SimpleAsmx.cs"
Class="SimpleAsmx" %>

------ App_Code/SimpleAsmx.cs contains:

ļ»æusing System;
using System.Collections;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class SimpleAsmx : System.Web.Services.WebService
{

    public SimpleAsmx()
    {
    }

    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }

    [WebMethod]
    public string SayHelloToMe(string name)
    {
        return string.Format("Hello {0}, how are you?", name);
    }

}


------- Output:

Server Error in '/' Application
--------------------------------------------------------------------------------

An element with the same key already exists in the dictionary.
Description: HTTP 500. Error processing request.

Stack Trace:

System.ArgumentException: An element with the same key already exists in the
dictionary.  at
System.Collections.Generic.Dictionary`2[System.Object,System.Object].Add
(System.Object key, System.Object value) [0x00000]   at
System.Web.Compilation.BuildManager.AddToCache (System.String virtualPath,
System.Web.Compilation.BuildProvider bp) [0x00000]   at
System.Web.Compilation.BuildManager.GenerateAssembly
(System.Web.Compilation.AssemblyBuilder abuilder,
System.Collections.Generic.List`1 buildItems, System.Web.VirtualPath
virtualPath, BuildKind buildKind) [0x00000]   at
System.Web.Compilation.BuildManager.BuildAssembly (System.Web.VirtualPath
virtualPath) [0x00000]   at
System.Web.Compilation.BuildManager.GetCompiledType (System.String
virtualPath) [0x00000]   at
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler
(System.Web.HttpContext context, System.String verb, System.String url,
System.String filePath) [0x00000]   at
System.Web.Script.Services.ScriptHandlerFactory.GetHandler
(System.Web.HttpContext context, System.String requestType, System.String
url, System.String pathTranslated) [0x00000]   at
System.Web.HttpApplication.GetHandler (System.Web.HttpContext context,
System.String url, Boolean ignoreContextHandler) [0x00000]   at
System.Web.HttpApplication.GetHandler (System.Web.HttpContext context,
System.String url) [0x00000]   at
System.Web.HttpApplication+<Pipeline>c__Iterator5.MoveNext () [0x00000]

--------------------------------------------------------------------------------
Version information: Mono Version: 2.0.50727.1433; ASP.NET Version:
2.0.50727.1433


Environment:

Mono preview 2
Apache/2.2.10 (Win32)  mod_mono/1.9
Windows Vista



More information about the Mono-list mailing list