The remote server returned an error: (401) Unauthorized.

1,148 vistas
Ir al primer mensaje no leído

marcus

no leída,
31 may 2011, 6:55:57 a.m.31/5/2011
para ravendb
I'm having this issue when I run my application, I have added the
following reserved url on my dev machine

Reserved URL : http://+:8000/
User: \Everyone
Listen: Yes
Delegate: No
SDDL: D:(A;;GX;;;WD)

Raven gives me this in the console
Request # 3: GET - 0 ms - <default> - 404 - /docs/Raven/
Replication/Destinations

and this is the stacktrace

[WebException: The remote server returned an error: (401)
Unauthorized.]
System.Net.HttpWebRequest.GetResponse() +7769892
Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func`1
getResponse) in c:\Builds\raven\Raven.Client.Lightweight\Connection
\HttpJsonRequest.cs:89

[InvalidOperationException]
Raven.Client.Connection.HttpJsonRequest.ReadStringInternal(Func`1
getResponse) in c:\Builds\raven\Raven.Client.Lightweight\Connection
\HttpJsonRequest.cs:107
Raven.Client.Connection.HttpJsonRequest.ReadResponseString() in c:
\Builds\raven\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:
81
Raven.Client.Connection.ServerClient.PutIndex(String name,
IndexDefinition definition, Boolean overwrite) in c:\Builds\raven
\Raven.Client.Lightweight\Connection\ServerClient.cs:621

Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDatabaseCommands
databaseCommands, DocumentConvention documentConvention) in c:\Builds
\raven\Raven.Client.Lightweight\Indexes\AbstractIndexCreationTask.cs:
81
Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider
catalogToGetnIndexingTasksFrom, IDatabaseCommands databaseCommands,
DocumentConvention conventions) in c:\Builds\raven
\Raven.Client.Lightweight\Indexes\IndexCreation.cs:44
Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider
catalogToGetnIndexingTasksFrom, IDocumentStore documentStore) in c:
\Builds\raven\Raven.Client.Lightweight\Indexes\IndexCreation.cs:55
Raven.Client.Indexes.IndexCreation.CreateIndexes(Assembly
assemblyToScanForIndexingTasks, IDocumentStore documentStore) in c:
\Builds\raven\Raven.Client.Lightweight\Indexes\IndexCreation.cs:32

Stormbreaker.Bootstrapper.<Initialize>b__1(IInitializationExpression
x) +562
StructureMap.ObjectFactory.Initialize(Action`1 action) in c:\code
\structuremap\Source\StructureMap\ObjectFactory.cs:61
Stormbreaker.Bootstrapper.Initialize() +157
Stormbreaker.App_Start.Initializer.Start() +44

[TargetInvocationException: Exception has been thrown by the target of
an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo
method, Object target, Object[] arguments, SignatureStruct& sig,
MethodAttributes methodAttributes, RuntimeType typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo
method, Object target, Object[] arguments, Signature sig,
MethodAttributes methodAttributes, RuntimeType typeOwner) +152
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture,
Boolean skipVisibilityChecks) +393
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
+38
System.Reflection.MethodBase.Invoke(Object obj, Object[]
parameters) +35
WebActivator.ActivationManager.RunActivationMethods() +262
WebActivator.ActivationManager.Run() +27

[InvalidOperationException: The pre-application start initialization
method Run on type WebActivator.ActivationManager threw an exception
with the following error message: Exception has been thrown by the
target of an invocation..]

System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1
methods) +11539982
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +465
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager
appManager, IApplicationHost appHost, IConfigMapPathFactory
configMapPathFactory, HostingEnvironmentParameters hostingParameters,
PolicyLevel policyLevel, Exception appDomainCreationException) +1087

[HttpException (0x80004005): The pre-application start initialization
method Run on type WebActivator.ActivationManager threw an exception
with the following error message: Exception has been thrown by the
target of an invocation..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
+11529072
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
+141

System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +4784373

Itamar Syn-Hershko

no leída,
31 may 2011, 1:23:02 p.m.31/5/2011
para rav...@googlegroups.com
What build are you using? and how do you initialize your DocumentStore object?

marcus

no leída,
31 may 2011, 1:41:20 p.m.31/5/2011
para ravendb
I'm using 1.0.0.371 and my documentstore is initialized like this

var documentStore = new DocumentStore { ConnectionStringName =
"RavenDB" };
documentStore.Initialize();

Itamar Syn-Hershko

no leída,
31 may 2011, 1:46:23 p.m.31/5/2011
para rav...@googlegroups.com
Ok, this is an issue with the connection string parsing we fixed in 373, which is unstable. Can you try that build?

marcus

no leída,
31 may 2011, 2:03:26 p.m.31/5/2011
para ravendb
I'm getting the same 404 message in raven but another exception

Server Error in '/' Application.
Cannot close stream until all bytes are written.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.IOException: Cannot close stream until
all bytes are written.

Source Error:

Line 55: documentStore.Conventions.FindTypeTagName =
type => typeof(IPageModel).IsAssignableFrom(type) ? "Pages" : null;
Line 56:
Line 57:
IndexCreation.CreateIndexes(typeof(Documents_ByParent).Assembly,
documentStore);
Line 58:
IndexCreation.CreateIndexes(typeof(Document_ByUrl).Assembly,
documentStore);
Line 59:

Itamar Syn-Hershko

no leída,
31 may 2011, 2:14:15 p.m.31/5/2011
para rav...@googlegroups.com
Can you post the full stack trace please?

Also, if Document_ByUrl and Documents_ByParent are in the same assembly the second call is redundant.

marcus

no leída,
31 may 2011, 2:26:25 p.m.31/5/2011
para ravendb
[IOException: Cannot close stream until all bytes are written.]
System.Net.ConnectStream.CloseInternal(Boolean internalCall,
Boolean aborting) +838

[WebException: The request was aborted: The request was canceled.]
System.Net.ConnectStream.CloseInternal(Boolean internalCall,
Boolean aborting) +1256
System.Net.ConnectStream.System.Net.ICloseEx.CloseEx(CloseExState
closeState) +46
System.Net.ConnectStream.Dispose(Boolean disposing) +191
System.IO.Stream.Close() +28
Raven.Client.Connection.HttpJsonRequest.Write(Byte[] byteArray) in
c:\Builds\raven-unstable\Raven.Client.Lightweight\Connection
\HttpJsonRequest.cs:187
Raven.Client.Connection.HttpJsonRequest.Write(String data) in c:
\Builds\raven-unstable\Raven.Client.Lightweight\Connection
\HttpJsonRequest.cs:172
Raven.Client.Connection.ServerClient.PutIndex(String name,
IndexDefinition definition, Boolean overwrite) in c:\Builds\raven-
unstable\Raven.Client.Lightweight\Connection\ServerClient.cs:618

Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDatabaseCommands
databaseCommands, DocumentConvention documentConvention) in c:\Builds
\raven-unstable\Raven.Client.Lightweight\Indexes
\AbstractIndexCreationTask.cs:81
Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider
catalogToGetnIndexingTasksFrom, IDatabaseCommands databaseCommands,
DocumentConvention conventions) in c:\Builds\raven-unstable
\Raven.Client.Lightweight\Indexes\IndexCreation.cs:44
Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider
catalogToGetnIndexingTasksFrom, IDocumentStore documentStore) in c:
\Builds\raven-unstable\Raven.Client.Lightweight\Indexes
\IndexCreation.cs:55
Raven.Client.Indexes.IndexCreation.CreateIndexes(Assembly
assemblyToScanForIndexingTasks, IDocumentStore documentStore) in c:
\Builds\raven-unstable\Raven.Client.Lightweight\Indexes
\IndexCreation.cs:32

Stormbreaker.Bootstrapper.<Initialize>b__1(IInitializationExpression
x) in D:\Projects\Git\Stormbreaker\src\Stormbreaker\Stormbreaker
\Bootstrapper.cs:57
StructureMap.ObjectFactory.Initialize(Action`1 action) in c:\code
\structuremap\Source\StructureMap\ObjectFactory.cs:61
Stormbreaker.Bootstrapper.Initialize() in D:\Projects\Git
\Stormbreaker\src\Stormbreaker\Stormbreaker\Bootstrapper.cs:45
Stormbreaker.App_Start.Initializer.Start() in D:\Projects\Git
\Stormbreaker\src\Stormbreaker\Stormbreaker\App_Start\Initializer.cs:
36

Itamar Syn-Hershko

no leída,
31 may 2011, 2:52:47 p.m.31/5/2011
para rav...@googlegroups.com
I'm not sure whats going on. Does removing the second call to CreateIndexes makes any difference?

Can you create a small test or project reproducing this?

marcus

no leída,
31 may 2011, 3:22:07 p.m.31/5/2011
para ravendb
I was able to get things going again, I don't really know what
happened there but the initial 401 error seems to be a problem with
the connection cause if I change from connectionStringName to Url it
all works great
> ...
>
> read more »

bbqchickenrobot

no leída,
1 jun 2011, 10:48:21 p.m.1/6/2011
para ravendb
Hi all, new to raven - I am attempting to create a new database with
the following code and i'm getting this error:

"The remote server returned an error: (401) Unauthorized."

Code:

using (var docStore = new DocumentStore() { Url = "http://
db01:8888" })
{
docStore.Initialize();

docStore.DatabaseCommands.EnsureDatabaseExists("mydb"); // error
occurs right here
using (var session = docStore.OpenSession("mydb"))
{
var dbconfig = session.Query<DatabaseConfig>()
.Where(x => x.Id == "mydb")
.FirstOrDefault();

if (dbconfig == null)
{
var config = new DatabaseConfig();
config.AllowReinitialization = true;
config.ID = Guid.NewGuid();
config.InstallDate = DateTime.UtcNow;
session.Store(config);
session.SaveChanges();
}
}
}

Itamar Syn-Hershko

no leída,
2 jun 2011, 1:42:59 a.m.2/6/2011
para rav...@googlegroups.com
What build are you using? 

Are you sure the server and port are accessible?

Itamar
Hibernating Rhinos

Ayende Rahien

no leída,
2 jun 2011, 1:50:38 a.m.2/6/2011
para rav...@googlegroups.com
Are you using an account that also exists on the db01 machine?

On Thu, Jun 2, 2011 at 5:48 AM, bbqchickenrobot <bbqchic...@gmail.com> wrote:

bbqchickenrobot

no leída,
2 jun 2011, 1:16:06 p.m.2/6/2011
para ravendb
No, i'm not.... I don't have any security setup - maybe this is my
problem? How do I go about configuring this? Do I need to have RavenDB
run through IIS? I can read up and configure this. Secondly, what if
my development machine is on a different domain than the testing/
staging database? Would this cause a problem? Wasn't quite sure how
to setup security with Raven.

Also, temporarily, I adjusted the AllowAnonymousAccess key to All from
Get and it works. But somehow, I think this is not very security
minded.

On Jun 1, 10:50 pm, Ayende Rahien <aye...@ayende.com> wrote:
> Are you using an account that also exists on the db01 machine?
>
> On Thu, Jun 2, 2011 at 5:48 AM, bbqchickenrobot
> <bbqchickenro...@gmail.com>wrote:

bbqchickenrobot

no leída,
2 jun 2011, 1:13:45 p.m.2/6/2011
para ravendb
Hi Itamar, thx for your reply...

I am using build 371 and yes, the server and the port (8888) are
accessible... Raven Studio runs no problem and I can perform other
operations on the database.

On Jun 1, 10:42 pm, Itamar Syn-Hershko <ita...@ayende.com> wrote:
> What build are you using?
>
> Are you sure the server and port are accessible?
>
> Itamar
> Hibernating Rhinos
>
> On Thu, Jun 2, 2011 at 5:48 AM, bbqchickenrobot
> <bbqchickenro...@gmail.com>wrote:

Ayende Rahien

no leída,
2 jun 2011, 1:50:40 p.m.2/6/2011
para rav...@googlegroups.com
You need to specify user/pass in the connection string.
They are windows user name & pass.

Itamar Syn-Hershko

no leída,
2 jun 2011, 3:07:27 p.m.2/6/2011
para rav...@googlegroups.com
You seem to be suffering from the connection string bug. Can you work with 373 or latest until we have another stable release?
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos