Remoting from GINA

Our app needs the services of remote objects during the logon process (say, to log invalid log on attempts). We have a replacement GINA in place and it uses COM to invoke a COM-enabled CLR object. This object in turn does the remoting stuff.

All the objects are connected up and working but during initialisation, the CLR object performs a RemotingConfiguration.Configure(...) call which throws an exception (apologies, its a a lengthy one) and I've currently no idea how to progress. The exception relays something about illegal characters in path. Obviously, I've checked what I'm passing to the call and it's fine. Other than that, it may be a permissions thing (given that there is no-one logged on at that time).

Needless to say, if I write an app to load the same DLL, all works fine and there are no configuration issues.

Does anyone know if there's a problem remoting from GINA

Many thanks

~swg

Remoting configuration failed with the exception 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize
---> System.ArgumentException: Illegal characters in path.
at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigurationHost.get_ConfigPaths()
at System.Configuration.ClientConfigurationHost.GetStreamName(String configPath)
at System.Configuration.ClientConfigurationSystem..ctor()
at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
--- End of inner exception stack trace ---
at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
at System.Diagnostics.TraceSource.Initialize()
at System.Net.Logging.InitializeLogging()
at System.Net.Logging.get_On()
at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
at System.Runtime.Remoting.Channels.CoreChannel.GetMachineName()
at System.Runtime.Remoting.Channels.CoreChannel.GetMachineIp()
at System.Runtime.Remoting.Channels.Http.HttpServerChannel.SetupMachineName()
at System.Runtime.Remoting.Channels.Http.HttpServerChannel..ctor(IDictionary properties, IServerChannelSinkProvider sinkProvider)
at System.Runtime.Remoting.Channels.Http.HttpChannel..ctor(IDictionary properties, IClientChannelSinkProvider clientSinkProvider, IServerChannelSinkProvider serverSinkProvider)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Runtime.Remoting.RemotingConfigHandler.CreateChannelFromConfigEntry(ChannelEntry entry)
at System.Runtime.Remoting.RemotingConfigHandler.ConfigureChannels(RemotingXmlConfigFileData configData, Boolean ensureSecurity)
at System.Runtime.Remoting.RemotingConfigHandler.ConfigureRemoting(RemotingXmlConfigFileData configData, Boolean ensureSecurity)'.



Answer this question

Remoting from GINA

  • Jason Chan

    Hi John,

    I've actually posted further info by replying to my own post, but that info seems to have disappeared!! (It WAS there, honestly, I checked!).

    So, to summarize what that 2nd post said, I did check the path being passed in by writing it to the event log. It's was fine. So, what I did was to ignore the config file and encode the contents by manually coding the config in c#. Here is the code ...

    RemotingConfiguration.ApplicationName = "EventTester";
    RemotingConfiguration.RegisterWellKnownClientType(typeof(IMyType), tcp://localhost:1234/event.rem");
    Hashtable httpProperties = new Hashtable();
    httpProperties[
    "useDefaultCredentials"] = "true";
    BinaryClientFormatterSinkProvider cli =
    new BinaryClientFormatterSinkProvider();
    BinaryServerFormatterSinkProvider svr =
    new BinaryServerFormatterSinkProvider();
    svr.TypeFilterLevel = System.Runtime.Serialization.Formatters.
    TypeFilterLevel.Full;
    HttpChannel http =
    new HttpChannel(httpProperties, cli, svr);
    ChannelServices.RegisterChannel(http,false);

    ... and the line it choks off at is the HttpChannel creation, throwing a "Configuration system failed to initialize" exception.

    So there you have it.

    Thanks,

    ~swg


  • cbwick

    Swg, I can't say that I've run into this before, but I'm guessing it has something to do with the unique environment that MSGINA code runs under.

    Do you have any way to either break into a debugger when this happens or generate a dump file It'd be useful to find out what path is being passed in.

    Cheers,

    JJustice [MSFT]


  • Paulo Silva Jr.

    .NET is not supported for GINA. You will need to write C or C++. .NET framework may not even be loaded yet when a GINA needs to function.



  • Steven Molen

    Swg, I suspect the issue is that the special environment we load for GINA code doesn't include some of the things the CLR needs to execute correctly. Judging from your exception, there may be parts of the local user environment that aren't in place, causing the config subsystem to fail. I'm actually a bit surprised that your code got as far as it did. Sorry this wasn't the answer you were looking for.

    Cheers,

    JJustice [MSFT]


  • Sam Jarawan

    Thanks John,

    However, I hope you'll forgive my persistence. I need more "meat" to the reason why it wont work. I can COM out of GINA quite happily and make some framework calls from there so (as a professional s/w developer) I need to find out more details of this environment and why it does not support the "full" framework. I can kinda understand it when the environment is in a logged-off state. But when logged on, the framework is loaded, all services are running - I need to understand why it doesn't click together. To this end I have a call in to MS via BetaOne services. Hopefully they will come back with the full breakdown. If it is appropriate, I'll then post it here.

    Thanks for all feedback guys,

    ~swg

    p.s. Oh and one other thing, given this was my initial post, I would have thought it up-to-me to specify whether a particular reply represents "The Answer". It seems someone has checked Michiko's "Oh you just can't do it" as the answer, which, IMHO, is no answer at all. Unfortunately, I don't seem to be able to remove it. Hey ho.


  • marksaxton

    Does these mean that we cannot use .net to develop alternative login using

  • bh7

    Well, here it is. The official MS line is ... "we don't support it". So it looks like I'm not going to get any more meat on this particular bone. Check out this superfluous knowledge-base article for (not much) further info.

    http://support.microsoft.com/ scid=kb;en-us;841927&spid=7796&sid=global

    It says, I shouldn't use .NET, COM, COM+ or pretty much anything really, which makes contacting a database pretty tricky. I was doing this in an n-tier architecture but I'll be lucky if I can get to the DB server directly at this rate!!

    So, frustrated though I am, I shall regretfully mark this as "The Answer"

    Thanks again to all who gave this some thought.

    Cheers,

    ~swg


  • *Elad*

    Swg, are you targeting XP, Vista, Server 2003, or some other OS

    Cheers,

    JJustice [MSFT]


  • zhuyanjun

    John,

    We are targetting XP and Windows 2003 at this time. Or at least this code does. We will be targetting Vista at some later stage.

    Michiko,

    Perhaps you can explain how .net is not supported. If you logon, and commence using your PC to run applications, the framework is loaded, yes What if you then lock the PC, isn't the framework still loaded So what prevents code in GINA making framework calls Well the answer is nothing of course because it works perfectly well ... it is just the remoting configuration that doesn't work (and maybe the remoting itself, of course, but I haven't got that far yet )

    ~swg


  • Remoting from GINA