Invalid URI: The URI scheme is not valid

1,927 views
Skip to first unread message

Chris Davis

unread,
Apr 19, 2012, 4:36:44 PM4/19/12
to ravendb
Build: 888

Code:

using (var documentStore = new DocumentStore() { Url =
ConfigurationManager.ConnectionStrings["RavenDB"].ConnectionString })
{
documentStore.Initialize();

using (var session = documentStore.OpenSession())
{
foreach (var userStory in userStories)
session.Store(userStory);

session.SaveChanges();
}
}

---------------------------------------------------

The above code was working fine all day until late this afternoon.
Now, I get the error Invalid URI: The URI scheme is not valid.

Any thoughts on what it might be?

Thanks for the help,
Chris

Itamar Syn-Hershko

unread,
Apr 19, 2012, 4:41:49 PM4/19/12
to rav...@googlegroups.com
What is the server version?

And what is the complete stack trace?

Chris Davis

unread,
Apr 19, 2012, 4:53:49 PM4/19/12
to ravendb
Sorry, stack trace:

[UriFormatException: Invalid URI: The URI scheme is not valid.]
System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind
uriKind) +6239852
System.Uri..ctor(String uriString) +20
System.Net.WebRequest.Create(String requestUriString) +35
Raven.Client.Connection.HttpJsonRequest..ctor(String url, String
method, RavenJObject metadata, ICredentials credentials,
HttpJsonRequestFactory factory, IHoldProfilingInformation owner,
DocumentConvention conventions) in c:\Builds\RavenDB-Stable
\Raven.Client.Lightweight\Connection\HttpJsonRequest.cs:73

Raven.Client.Connection.HttpJsonRequestFactory.CreateHttpJsonRequest(IHoldProfilingInformation
self, String url, String method, RavenJObject metadata, ICredentials
credentials, DocumentConvention convention) in c:\Builds\RavenDB-Stable
\Raven.Client.Lightweight\Connection\HttpJsonRequestFactory.cs:70
Raven.Client.Connection.ServerClient.DirectGet(String serverUrl,
String key) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight
\Connection\ServerClient.cs:253
Raven.Client.Connection.<>c__DisplayClass1.<Get>b__0(String u) in c:
\Builds\RavenDB-Stable\Raven.Client.Lightweight\Connection
\ServerClient.cs:114
Raven.Client.Connection.ServerClient.TryOperation(Func`2 operation,
String operationUrl, Boolean avoidThrowing, T& result) in c:\Builds
\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:
222
Raven.Client.Connection.ServerClient.ExecuteWithReplication(String
method, Func`2 operation) in c:\Builds\RavenDB-Stable
\Raven.Client.Lightweight\Connection\ServerClient.cs:192
Raven.Client.Connection.ServerClient.Get(String key) in c:\Builds
\RavenDB-Stable\Raven.Client.Lightweight\Connection\ServerClient.cs:
114
Raven.Client.Document.HiLoKeyGenerator.GetDocument() in c:\Builds
\RavenDB-Stable\Raven.Client.Lightweight\Document\HiLoKeyGenerator.cs:
155
Raven.Client.Document.HiLoKeyGenerator.GetNextMax() in c:\Builds
\RavenDB-Stable\Raven.Client.Lightweight\Document\HiLoKeyGenerator.cs:
110
Raven.Client.Document.HiLoKeyGenerator.NextId() in c:\Builds
\RavenDB-Stable\Raven.Client.Lightweight\Document\HiLoKeyGenerator.cs:
83

Raven.Client.Document.HiLoKeyGenerator.GenerateDocumentKey(DocumentConvention
convention, Object entity) in c:\Builds\RavenDB-Stable
\Raven.Client.Lightweight\Document\HiLoKeyGenerator.cs:65

Raven.Client.Document.MultiTypeHiLoKeyGenerator.GenerateDocumentKey(DocumentConvention
conventions, Object entity) in c:\Builds\RavenDB-Stable
\Raven.Client.Lightweight\Document\MultiTypeHiLoKeyGenerator.cs:75
Raven.Client.Document.<>c__DisplayClass2.<Initialize>b__1(Object
entity) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document
\DocumentStore.cs:363
Raven.Client.Document.DocumentConvention.GenerateDocumentKey(Object
entity) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document
\DocumentConvention.cs:251

Raven.Client.Document.InMemoryDocumentSessionOperations.GetOrGenerateDocumentKey(Object
entity) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document
\InMemoryDocumentSessionOperations.cs:626

Raven.Client.Document.InMemoryDocumentSessionOperations.StoreInternal(Object
entity, Nullable`1 etag, String id) in c:\Builds\RavenDB-Stable
\Raven.Client.Lightweight\Document
\InMemoryDocumentSessionOperations.cs:568

Raven.Client.Document.InMemoryDocumentSessionOperations.Store(Object
entity) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document
\InMemoryDocumentSessionOperations.cs:514
RallyPoC.Models.RallyModel.LoadTestRallyUserStories() in C:\Docs
\VSProjects\RallyPoC\RallyPoC\Models\RallyModel.cs:25

I'm running this from my workstation at the moment (Windows 7 64bit)
while working on a PoC for a new project.


On Apr 19, 4:41 pm, Itamar Syn-Hershko <ita...@hibernatingrhinos.com>
wrote:
> What is the server version?
>
> And what is the complete stack trace?
>

Itamar Syn-Hershko

unread,
Apr 19, 2012, 4:58:04 PM4/19/12
to rav...@googlegroups.com
Just do new DocumentStore {  ConnectionStringName  = "RavenDB" }

Chris Davis

unread,
Apr 19, 2012, 5:00:51 PM4/19/12
to ravendb
Outstanding, it works!

Thanks for the help,
Chris

On Apr 19, 4:58 pm, Itamar Syn-Hershko <ita...@hibernatingrhinos.com>
wrote:
> Just do new DocumentStore {  ConnectionStringName  = "RavenDB" }
>
> See herehttp://ravendb.net/docs/client-api/connecting-to-a-ravendb-datastore

Justin A

unread,
Apr 19, 2012, 8:28:09 PM4/19/12
to rav...@googlegroups.com
I know Itamar already answered this, bit it sounds like the Connectionstring -value- in the web.config/app.config file was/is incorrect. to use the Url property i think the value needs to be something like this: http://localhost:8080    .. eg. http://{0}:[1} .. servername or ip / port. 


-me-

Chris Davis

unread,
Apr 20, 2012, 8:18:36 AM4/20/12
to ravendb
My url was http://localhost:8080 and was working all day (client/
server version). I switched to the embedded version for unit testing
and then everything broke - weird. I switched from using the Url to
using the ConnectionString (same exact string value) and everything
started working again.
Reply all
Reply to author
Forward
0 new messages