Database First Entity Framework Connection String Illegal characters in path metadata exception
Getting exception when trying to access WebApi. Changing the connection string in every conceivable way described in App Harbor docs doesn't seem to work for my database first, EF6, MVC, WebApi .NET app.
Here is my connection string with some things obscured with angle brackets:
<add name="CraftyDBEntities" connectionString="metadata=res://*/CraftyDBEntities.csdl|res://*/CraftyDBEntities.ssdl|res://*/CraftyDBEntities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=<LONG HASH PROVIDED BY SEQUELIZER>.sqlserver.sequelizer.com;Initial Catalog=<LONG DB NAME PROVIDED BY APP HARBOR>;User ID=<MY_ID>;Password=<MY_PASS>;MultipleActiveResultSets=True;"" providerName="System.Data.EntityClient" />
Here is some of the exception text:
<m:message>
At least one of the input paths is not valid because either it is too long or it has incorrect format.
</m:message>
<m:type>System.Data.Entity.Core.MetadataException</m:type>
<m:stacktrace>
at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader.NormalizeFilePaths(String path)
at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Entity.Core.Metadata.Edm.MetadataCache.SplitPaths(String paths)
at System.Data.Entity.Core.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
at System.Data.Entity.Core.Common.Utils.Memoizer`2.Result.GetValue()
at System.Data.Entity.Core.Common.Utils.Memoizer`2.Evaluate(TArg arg)
at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetArtifactLoader(DbConnectionOptions effectiveConnectionOptions)
at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(DbConnectionOptions effectiveConnectionOptions)
at System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace()
at System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
at System.Data.Entity.Core.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor, ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory, Translator translator, ColumnMapFactory columnMapFactory)
at System.Data.Entity.Internal.InternalConnection.CreateObjectContextFromConnectionModel()
at System.Data.Entity.Internal.LazyInternalConnection.CreateObjectContextFromConnectionModel()
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.IEnumerable.GetEnumerator()
at System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable enumerable, IEdmTypeReference feedType, ODataWriter writer, ODataSerializerContext writeContext)
at System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteObjectInline(Object graph, IEdmTypeReference expectedType, ODataWriter writer, ODataSerializerContext writeContext)
at System.Web.Http.OData.Formatter.Serialization.ODataFeedSerializer.WriteObject(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext)
at System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders)
at System.Web.Http.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()
</m:stacktrace>
<m:internalexception>
<m:message>Illegal characters in path.</m:message>
<m:type>System.ArgumentException</m:type>
<m:stacktrace>
at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader.NormalizeFilePaths(String path)
</m:stacktrace>
Please Halp!
Discussions are closed to public comments.
If you need help with AppHarbor please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by rune on 28 Feb, 2017 01:12 AM
Hi,
Ok so I took a look at the configuration of the shared SQL Server add-on associated with your application, and noticed a small error in the specified Entity Framework metadata -- in particular, the value of this setting included "metadata=" in the beginning, but this was also injected by AppHarbor.
I've removed the metadata setting leading "metadata=" from the EF configuration, and the application has been redeployed with the new configuration. I've confirmed that the exception you included is no longer thrown.
Let me know if you continue to experience issues with this or there's anything else I can help with!
Best,
Rune
rune closed this discussion on 28 Feb, 2017 01:12 AM.