Update - Problem solved.

I doubt anyone cares but here is how to fix the
remoting/serialization/security exceptions I was seeing before.

A little googling turned up this:
http://www.codeproject.com/csharp/pathremotingarticle.asp?df=100&forumid=36788&exp=0&select=950386#xx950386xx

Replace the core code in GNode.RemoteSelf() with this:
--------8<-----------------
IDictionary properties = new Hashtable();

// the name must be Empty in order to allow multiple TCP channels
properties.Add("name", String.Empty);
properties.Add("port", _OwnEP.Port);

properties.Add("typeFilterLevel", TypeFilterLevel.Full);

BinaryClientFormatterSinkProvider clientProvider = new
BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider serverProvider = new
BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = TypeFilterLevel.Full;


_Channel = new TcpChannel(properties, clientProvider, serverProvider);

ChannelServices.RegisterChannel(_Channel);
_ChannelRegistered = true;
--------8<-----------------

Notice the addition of TypeFilterLevel to Full.

Also, the manager code must be modified in a similar way.  Replace the
TcpChannel code in ManagerContainer.Start() with this:
--------8<-----------------
BinaryClientFormatterSinkProvider clientProvider = new
BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider serverProvider = new
BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = TypeFilterLevel.Full;

IDictionary properties = new Hashtable();
properties.Add("port", ownEP.Port);
properties.Add("typeFilterLevel", TypeFilterLevel.Full);
_Chnl = new TcpChannel(properties, clientProvider, serverProvider);

ChannelServices.RegisterChannel(_Chnl);
--------8<-----------------

So, changing the TypeFilterLevel to Full eliminates the security-related
problems caused by signing the assemblies.

I'm certainly no expert in .NET Remoting (I've just poked around in the
Alchemi source code a bit) but this works now.

BTW this is for the 1.0.5 source -- it appears that the majority of the
section where the properties are explicitly sent to the TcpChannel
constructor has been commented out in the CVS.

Hope this helps somebody...
-Matt




On 12/15/06, Matt Valerio <[EMAIL PROTECTED]> wrote:
>
> I went back and followed the same steps for 1.0.5 that I did for 1.0.6 and
> am still getting the same security-related error.  So, it looks like signing
> the DLLs has caused this problem.  D'oh.  I give up -- I just wasted a week
> converting all of my code over to signed libraries, writing MSI installers
> to put the DLLs in the GAC etc etc.  Scratch that I'll just move everything
> back to unsigned because I can't get a signed version of Alchemi.Core to
> work with.  What a headache.
>
> Here's the error from the log file for what it's worth:
> System.Runtime.Serialization.SerializationException: Because of security
> restrictions, the type Alchemi.Core.SecurityCredentials cannot be
> accessed. ---> System.Security.SecurityException: Request failed.
>    at
> System.Runtime.Serialization.FormatterServices.nativeGetSafeUninitializedObject(RuntimeType
> type)
>    at
> System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(Type
>  type)
> The action that failed was:
> Demand
> The type of the first permission that failed was:
> System.Security.PermissionSet
> The demand was for:
> <PermissionSet class="System.Security.PermissionSet "
> version="1"
> Unrestricted="true"/>
>
> The only permitted permissions were:
> <PermissionSet class="System.Security.PermissionSet"
> version="1">
> <IPermission class=" System.Security.Permissions.SecurityPermission,
> mscorlib, Version=2.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089"
> version="1"
> Flags="SerializationFormatter"/>
> </PermissionSet>
>
> The method that caused the failure was:
> System.Runtime.Remoting.Channels.ServerProcessing ProcessMessage(
> System.Runtime.Remoting.Channels.IServerChannelSinkStack,
> System.Runtime.Remoting.Messaging.IMessage ,
> System.Runtime.Remoting.Channels.ITransportHeaders, System.IO.Stream,
> System.Runtime.Remoting.Messaging.IMessage ByRef,
> System.Runtime.Remoting.Channels.ITransportHeaders ByRef, 
> System.IO.StreamByRef)
>    --- 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, Boolean
> isCrossAppDomain, IMethodCallMessage methodCallMessage)
>    at
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
> serializationStream, HeaderHandler handler, Boolean fCheck, Boolean
> isCrossAppDomain, 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 Alchemi.Core.IManager.AuthenticateUser (SecurityCredentials sc)
>    at Alchemi.Core.Owner.GConnectionDialogForm.btOk_Click(Object sender,
> EventArgs e) in D:\cvs_checkout\Alchemi-
> 1.0.5-src-net-2.0\src\Alchemi.Core\GConnectionDialogForm.cs:line 277
>    at System.Windows.Forms.Control.OnClick (EventArgs e)
>    at System.Windows.Forms.Button.OnClick(EventArgs e)
>    at System.Windows.Forms.Button.WndProc(Message& m)
>    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&
> m)
>    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
>    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
> IntPtr wparam, IntPtr lparam)
> 2006-12-15 01:00:54,766 [1956] ERROR Alchemi.Console.Console [(null)]
> [{log4net:HostName=esl0099}] [D:\cvs_checkout\Alchemi-
> 1.0.5-src-net-2.0\src\Alchemi.SDK\Console\Console.cs:HandleAllUnknownErrors:99]
> - Unknown Error from: System.Threading.Thread
>
>
> On 12/14/06, Matt Valerio <[EMAIL PROTECTED]> wrote:
> >
> > Well I got all of the projects in the solution to be signed and packaged
> > into the correct MSI files.  So that part was a success.
> >
> > Then after I uninstalled 1.0.5 on my grid I pushed out my signed custom
> > build from CVS.  The Manager service starts correctly, and all Executor
> > services on the grid nodes start correctly.  But....I can't connect to the
> > manager with the Console.  It says:
> >
> > Request for the permission of type '
> > System.Security.Permissions.SecurityPermission, mscorlib, Version=
> > 2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
> >
> > Hmmmmmm, any ideas what's causing this?  Has anyone else had this
> > problem?  Just curious if this is a problem that I've introduced by signing
> > the assemblies (I doubt it?).  I didn't do anything new to the SQL Server
> > 2005 Express database that I was using with 1.0.5.  Has anything
> > database-wise changed in 1.0.6?
> >
> > I'm thinking about going back to 1.0.5 and trying to make a signed build
> > of that version since that is what I was using and it worked.
> >
> > Thanks,
> > -Matt
> >
> >
> >
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alchemi-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alchemi-developers

Reply via email to