0

I have set up an instance of RavenDB on IIS. I can connect to it just fine using a network service application, however when I try and connect then initialize using an application running under local administrator I get an error "Unable to determine the identity of domain". The only thing I can think of is trying to impersonate "Network Service", but I am not sure if that is possible. The administrator has full rights to raven web folder.

busbina
  • 549
  • 1
  • 7
  • 19

2 Answers2

1

Figured out this problem. I had to run my Raven document store connect and initialize in a different application domain. I ended up doing this.

string pathToDLL = installerFolder + "\\RavenSiteSetup.dll";
AppDomainSetup domainSetup = new AppDomainSetup {
                                 ApplicationBase = installerFolder,
                                 PrivateBinPath = pathToDLL
                             };

Evidence ev1 = new Evidence();

ev1.AddAssemblyEvidence(new ApplicationDirectory(
                         typeof(RavenSetup).Assembly.FullName)
                        );

ev1.AddHostEvidence(new Zone(SecurityZone.Internet));
AppDomain ad = AppDomain.CreateDomain("RavenSetup", ev1, domainSetup,
               Assembly.GetExecutingAssembly().PermissionSet,null);

IIdentity identity = new GenericIdentity("RavenSetup");
IPrincipal principal = new GenericPrincipal(identity, null);
ad.SetThreadPrincipal(principal);

RavenSetup remoteWorker = (RavenSetup)ad.CreateInstanceFromAndUnwrap(
            pathToDLL,
            typeof(RavenSetup).FullName);

remoteWorker.Connect(sitePath);
busbina
  • 549
  • 1
  • 7
  • 19
0

Connecting locally, are you using http://localhost:[port]? I've had problems using the domain name locally.

Try running your application locally and connect to the RavenDB via locahost address.

Judah Gabriel Himango
  • 58,906
  • 38
  • 158
  • 212
  • I am connecting with "http://localhost/testRaven" which works fine in my web app but fails in my local app. The address also works fine in my Silverlight app. The exception says its a "IsolatedStorageException" if that helps. – busbina Jul 19 '13 at 18:49
  • Sounds like a security issue, as if the web app is running in a trusted zone (say, Intranet) but the raven server is running in a different zone (say, Internet). Are they both running in the same Internet Explorer zone (keep in mind, it doesn't matter if you're accessing it in a different web browser; Silverlight uses these zones from Internet Explorer.) – Judah Gabriel Himango Jul 19 '13 at 21:30
  • Also, try using the machine name, instead of localhost – Ayende Rahien Jul 20 '13 at 01:21
  • Accessing from the browser works just fine. From my research it looks like my windows(c#) application does not have a AppDomain application base, and because of that ravenDB is unable to allocate isolated storage. – busbina Jul 25 '13 at 21:24