Simple remoting problem..

Simple remoting problem..

Old forum URL: forums.lhotka.net/forums/t/2403.aspx


ajj3085 posted on Thursday, February 22, 2007

Hi,

I'm trying to setup remoting, but am running into a problem.  I have it setup to use Windows authentication, but I'm getting the following exception:

System.Security.SecurityException: Principal must be of type BusinessPrincipal, not Nothing

I found the code, and that should only happen if CslaAuthentication is not Windows..

I'm a bit stumped..

Andy

ajj3085 replied on Thursday, February 22, 2007

Ok,

Got that figured out.. It needs to be in the Web.config as well..

Now I'm hitting another problem.  I'm getting a remoting exception, where the inner excetion is an ArgumentExcetion: Invalid token for impersonation - it cannot be duplicated.

Has anyone gotten remoting setup using Windows Authentication?

RockfordLhotka replied on Thursday, February 22, 2007

Windows user tokens can only make one hop. So if it hops from the client to your app server, you can NOT use it to also get to the database - at least that's my understanding. I wonder if that's the issue?

ajj3085 replied on Thursday, February 22, 2007

Possibly, although at the moment I'm only using one machine to host the client, IIS and the db.

There was a part of my code that was sending a WindowsIdentity to a CommandBase subclass, and then the executed command attempted to get the AD information from that identity.  I've changed it to pass the Token from the WI though, and now I'm stuck on a different error... something in my DP_E is using a null reference.. but I'm having problems tracking down exactly where (attaching to the aspnet_wp process doesn't seem to do the trick..).

I have the web.config to impersonate, and only allow Integrated Authentication..

When you say 'hop,' do you mean from server to server, or even within a server?   In my final configuration, the db server would also host IIS.

Andy

RockfordLhotka replied on Thursday, February 22, 2007

“Hop” includes cross-process too. Just because your server is running on your desktop doesn’t make it any less of a server. The token still moved from one place to another.

 

Rocky

 

From: ajj3085 [mailto:cslanet@lhotka.net]
Sent: Thursday, February 22, 2007 11:14 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Simple remoting problem..

 

Possibly, although at the moment I'm only using one machine to host the client, IIS and the db.

There was a part of my code that was sending a WindowsIdentity to a CommandBase subclass, and then the executed command attempted to get the AD information from that identity.  I've changed it to pass the Token from the WI though, and now I'm stuck on a different error... something in my DP_E is using a null reference.. but I'm having problems tracking down exactly where (attaching to the aspnet_wp process doesn't seem to do the trick..).

I have the web.config to impersonate, and only allow Integrated Authentication..

When you say 'hop,' do you mean from server to server, or even within a server?   In my final configuration, the db server would also host IIS.

Andy


ajj3085 replied on Thursday, February 22, 2007

I was afraid that hop would include cross-process.

I guess there's no way to setup a website with integrated security and also connect to the db with integrated security... that's a bummer.

xal replied on Thursday, February 22, 2007

ajj3085:
attaching to the aspnet_wp process doesn't seem to do the trick..


Andy,
Sorry to interrupt with an unrelated thing. I think we had a discussion about this a few months back...
You may already know this, but what the heck... It's not really necesary to attach to the process. You can create (or open) the project as an http project instead of the new "local folder" mode.
If you remove the project from the solution, you can go to add an existing web project to the solution and choose "Local IIS". Once you add it from there you'll be able to debug the web app directly in IIS without doing anything funny.

For new projects, when creating them, there's a combobox that lets you pick what type of web project you want. Choose to create it in iis too and that'll be it (This will create the project inside wwwroot, but you may want to create the directory and web app before doing this so that the folder resides where ever you want...).

Sorry for the "out of the subject" post.

Andrés

ajj3085 replied on Thursday, February 22, 2007

Andres,

The client application is actually a Windows forms application. 

I was attempting to attach to aspnet_wp so that I could debug the code running on the 'server' end of the remoting portal (http://localhost/RemotingHost/RemotingPortal.rem) in the same IDE as I used to launch & debug the client.

Now that you mention that other thread, I seem to recall that you couldn't use a single IDE to debug both "ends" of the application..

Or am I totally misunderstanding your post?  Smile [:)]

xal replied on Thursday, February 22, 2007

No, i did use just one ide...
But the same applies if all you want to do is debug what's happening in the remoting portal, since it's still a web site.
So, you can add the website that hosts the remoting portal to the solution (through IIS) and add a project reference from that website to the library project and you get painless automatic debugging on the server (that is, without needing to attach to aspnet_wp by hand).
Just a tip... Anyway, you may already know that... Smile [:)]

Andrés

RockfordLhotka replied on Thursday, February 22, 2007

Yeah, I do this all the time.

 

ProjectTracker is actually set up this way btw. The remoting host project references ProjectTracker.Library, allowing you to set breakpoints and step through the DataPortal_XYZ code, etc.

 

Rocky

 

 

From: xal [mailto:cslanet@lhotka.net]
Sent: Thursday, February 22, 2007 3:29 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Simple remoting problem..

 

No, i did use just one ide...
But the same applies if all you want to do is debug what's happening in the remoting portal, since it's still a web site.
So, you can add the website that hosts the remoting portal to the solution (through IIS) and add a project reference from that website to the library project and you get painless automatic debugging on the server (that is, without needing to attach to aspnet_wp by hand).
Just a tip... Anyway, you may already know that... Smile <img src=">

Andrés

ajj3085 replied on Thursday, February 22, 2007

Ahh... thanks for the tip then, I actually didn't know that.  That will prove very useful if I start using remoting.

Copyright (c) Marimer LLC