locked
Method Fails with serialization error when run using ASP.NET Development Server only RRS feed

  • Question

  • User-1041061984 posted
    I have a WebMethod that takes a single int as an input parameter and returns a class. This method runs fine under IIS6/2003 but when I run the site under the debugger using the ASP.NET Development Web Server (cassini?) it throws a serialization exception. The previous method works fine, but it has no arguments. I am using an HttpModule to established the Thread.CurrentPrincipal and Context.User to a custom principal object and you can see that it is indicating something about it in the error text, but it appears to run properly. Also, methods without arguments work fine and return the expected results. Also, since it works on IIS6, I'm guessing it's an issue with ASP.NET Development Web Server?

    My WebMethod never enters (the breakpoint never triggers) but my HttpModule OnAuthenticate stops at the breakpoint and traces just fine so I'm curious where to look next.

    Method signature in the namespace: Web.Services.Users.Get(int)

    Here is the event log message (truncated slightly):

    Event code: 3005
    Event message: An unhandled exception has occurred.
    Event time: 8/25/2006 8:39:52 AM
    Event time (UTC): 8/25/2006 1:39:52 PM
    Event ID: 7ab24b3c296048d7a395a67056c6abfb
    Event sequence: 25
    Event occurrence: 2
    Event detail code: 0
     
    Application information:
        Application domain: 1a050649-3-128009857968088768
        Trust level: Full
        Application Virtual Path: /epremis
        Application Path: C:\Inetpub\epremis\
        Machine name: MYLOCALMACHINE
     
    Process information:
        Process ID: 6172
        Process name: WebDev.WebServer.EXE
        Account name: (domain info stripped)
     
    Exception information:
        Exception type: SerializationException
        Exception message: Type is not resolved for member 'My.Security.SessionPrincipal,My.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
     
    Request information:
        Request URL: http://localhost:1265/projectname/wss/Users.asmx?mn=Get
        Request path: /epremis/wss/Users.asmx
        User host address: 127.0.0.1
        User: usernamegoeshere
        Is authenticated: True
        Authentication Type: Custom
        Thread account name: (domain account info stripped)
     
    Thread information:
        Thread ID: 4
        Thread account name: (domain account info stripped)
        Is impersonating: False
        Stack trace:    at Microsoft.VisualStudio.WebHost.Connection.get_RemoteIP()
       at Microsoft.VisualStudio.WebHost.Request.GetRemoteAddress()
       at System.Web.HttpRequest.get_UserHostAddress()
       at System.Web.HttpRequest.get_IsLocal()
       at System.Web.Configuration.CustomErrorsSection.CustomErrorsEnabled(HttpRequest request)
       at System.Web.HttpContext.get_IsCustomErrorEnabled()
       at Microsoft.Web.Services.RestHandler.WriteExceptionJsonString(HttpContext context, TextWriter writer, Exception ex)
       at Microsoft.Web.Services.RestHandler.ProcessRequest(HttpContext context)
       at Microsoft.Web.Services.ScriptHandlerFactory.HandlerWrapper.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


    Friday, August 25, 2006 9:53 AM

All replies

  • User-1041061984 posted

    This has been resolved with the following workaround:

    The issue is that cassini will break into separate AppDomains at will, which doesn't happen in IIS (even though they say it CAN). Because of this, when Atlas is trying to convert to the JSON to something on the server, it does something and switches and the .User custom principal doesn't deserialize because the assembly is not in the GAC and not registered with the other AppDomain.

    So, to avoid this for now, I've added a MarshalByRefObject to the base of my principal and identity objects and that seems to have resolved the issue for now.

    I'm not sure of any further performance problems with this approach, but we only need this for development and will probably just take the base class out for production builds.


     

    Sunday, August 27, 2006 3:05 PM
  • User1484661069 posted

     thx man...it helped...can u give me more info on solving this...?

    Tuesday, July 15, 2008 1:31 AM