Do you have a full stack trace for this exception?

One thing to watch out for is that you absolutely must call Remoting.GetContext () from the RPC function's thread. For example, this is good:

1
2
3
4
5
6
7
    [<Rpc>]
    let LoginAs username =
        let ctx = Web.Remoting.GetContext()
        async {
            do! ctx.UserSession.LoginUser username
            return ()
        }

but this is bad:

1
2
3
4
5
6
7
    [<Rpc>]
    let LoginAs username =
        async {
            let ctx = Web.Remoting.GetContext()
            do! ctx.UserSession.LoginUser username
            return ()
        }
By on 4/22/2015 6:57 AM ()

I did what you said and it fixed part of it. Now I can get the context but once I call

1
do! context.UserSession.LoginUser (session, true)

I get the exception again. Here is the stacktrace, doesn't look very useful. Should I look at a specific thread? Weird that this all works with non-OWIN.

1
2
3
4
5
6
7
8
9
FSharp.Core.dll!Microsoft.FSharp.Control.AsyncBuilderImpl.callA@803<Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit>.Invoke(Microsoft.FSharp.Control.AsyncParams<Microsoft.FSharp.Core.Unit> args)	Unknown
 	FSharp.Core.dll!Microsoft.FSharp.Control.Trampoline.ExecuteAction(Microsoft.FSharp.Core.FSharpFunc<Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Control.FakeUnitValue> firstAction)	Unknown
 	FSharp.Core.dll!Microsoft.FSharp.Control.TaskHelpers.continuation@1422<string>(Microsoft.FSharp.Control.AsyncParams<string> _arg1, Microsoft.FSharp.Control.AsyncParamsAux aux, System.Threading.Tasks.Task<string> completedTask)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.Execute()	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution)	Unknown
 	mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()	Unknown
By on 4/22/2015 6:03 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper