Remoting problems

Posts   
 
    
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 28-Jun-2005 22:30:53   

I'm successfully hosting a remoting server in IIS and sending LLBLGenPro entities to my client over HttpChannel in binary format. Now I want to instantiate and fill an entity on the client and then send back to the server where it will be saved in the database. When I do that I get this message:

An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll

Additional information: Because of security restrictions, the type SD.LLBLGen.Pro.ORMSupportClasses.EntityFields2 cannot be accessed.

The output window has some additional information:


Unhandled Exception: System.Runtime.Serialization.SerializationException: Because of security restrictions, the type SD.LLBLGen.Pro.ORMSupportClasses.EntityFields2 cannot be accessed. ---> System.Security.SecurityException: Request failed.
   at System.Security.SecurityRuntime.FrameDescSetHelper(FrameSecurityDescriptor secDesc, PermissionSet demandSet, PermissionSet& alteredDemandSet)
   at System.Runtime.Serialization.FormatterServices.nativeGetSafeUninitializedObject(RuntimeType type)
   at System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(Type type)
   --- End of inner exception stack trace ---

Server stack trace: 
   at System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(Type type)
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObject(ParseRecord pr)
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr)
   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage)
   at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)
   at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Chevron.Completions.Remoting.Interfaces.ICompletionsRemote.SaveCompletionStart(CompletionStartEntity completionStart)
   at Chevron.Completions.Local.BLL.CompletionManager.SaveCompletionStart(CompletionStartEntity completionStart) in C:\Clients\Chevron\Completions\Visual Studio\Chevron.Completions.Local.BLL\CompletionManager.cs:line 72
   at Chevron.Completions.Local.UI.MainWindow.New_Click(Object sender, EventArgs e) in c:\clients\chevron\completions\visual studio\chevron.completions.local.ui\mainwindow.cs:line 175
   at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.MenuItemData.Execute()
   at System.Windows.Forms.Command.Invoke()
   at System.Windows.Forms.Command.DispatchID(Int32 id)
   at System.Windows.Forms.Control.WmCommand(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainFThe program '[6176] CompletionsLocal.exe' has exited with code 0 (0x0).
orm)
   at Chevron.Completions.Local.UI.MainWindow.Main() in c:\clients\chevron\completions\visual studio\chevron.completions.local.ui\mainwindow.cs:line 155The program '[2612] aspnet_wp.exe: /LM/W3SVC/1/Root/Completions-1-127644788940156250' has exited with code 0 (0x0).

I haven't been able to figure out how to debug my remoting code on the server. I thought perhaps I should be attaching to the aspnet_wp.exe process, but I don't see it in the dialog. All these projects are in the same VS Studio solution, and everything is running on my machine.

I don't think the entity is even making it to the server because when I comment all the code in the server function that does something, I still get this error.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 28-Jun-2005 22:39:56   

Known issue with .net, please see: http://www.ingorammer.com/RemotingFAQ/Changes2003.html

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 29-Jun-2005 00:09:49   

Super, Frans, thanks a lot!!

Next question: what's the trick to debugging my remoting server? smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 29-Jun-2005 11:04:47   

Remote debugger in vs.net? simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 30-Jun-2005 06:17:28   

Hi,

For remoting, I normally create a windows service application and use it as the host for my remote objects. For debugging my remote object, I make a small windows form application and use it as the host of my remote object, then I configure VS.Net to start both my normal client application and my windows form host application. When the remote object dll is ok, I update the dll version that is consumed by the windows service.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 30-Jun-2005 09:26:44   

Cool tip, Rogelio!

Frans Bouma | Lead developer LLBLGen Pro
JimFoye avatar
JimFoye
User
Posts: 656
Joined: 22-Jun-2004
# Posted on: 01-Jul-2005 01:40:32   

Rogelio wrote:

Hi,

For remoting, I normally create a windows service application and use it as the host for my remote objects. For debugging my remote object, I make a small windows form application and use it as the host of my remote object, then I configure VS.Net to start both my normal client application and my windows form host application. When the remote object dll is ok, I update the dll version that is consumed by the windows service.

Thanks, I shall have to try this.

It seems like it Microsoft wouldn't make it so difficult (impossible?) to debug your remoting server when it's hosted by IIS - something that's generally recommended and frequently done, so far as I can tell. I just wonder if I'm missing something.

[edit] I fixed a misspelling.

Answer
User
Posts: 363
Joined: 28-Jun-2004
# Posted on: 01-Jul-2005 05:35:22   

i havent tried this, but if u added the asp.net web project to your solution, and have it configured for remoting, and u ran the project, wouldnt u get the debugging since its still part of the solution thats currently running?

I am going to be using this same setup for my next project that i am designing so if u figure out a good way to debug make sure to post it simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 01-Jul-2005 09:37:16   

On the server, the remote debugging objects have to be installed, use vs.net setup for that, then you can attach a debugger to the aspnet worker process and start debugging.

Frans Bouma | Lead developer LLBLGen Pro