I have just deployed my ASP.NET MVC 2 application using EF 4 and I am getting the following error:
Unable to load the specified metadata resource.
On my local machine it runs fine with no errors. This error only comes now when I deployed to the server. I have my enity data model file in MyProject.EntityModel. I used the POCO entity generator to separate my context and entities. These 2 are in another project called MyProject.Entities. I have the connection strings in the app.config in the 2 projects exactly the same. The connection string in the web.config in my MVC app is also the same. I'm not sure why this is giving me issues? I'm also running the app in IIS (that comes with Windows 7) and it works fine. The IIS version on the server is 6 (I think). Here is the full error message:
InnerException
Message: Unable to load the specified metadata resource.
Source: System.Data.Entity
StackTrace: at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataCache.SplitPaths(String paths)
at System.Data.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
at System.Data.Common.Utils.Memoizer`2.Result.GetValue()
at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg)
at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
at System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
at MyProject.HolsboerBFGA.Entities.HolsboerBFGAEntities..ctor()
at MyProject.HolsboerBFGA.WebMVC2.Controllers.HomeController..ctor()
Any advice would be appreciated.
Thanks.
I found the solution because i had this same problem. I had this problem because moved my .edmx to another folder and i had to change the namespace so when i run my project appear this error.
I resolved my problem by changing my connection string, adding the namespace "Model" (folder name) to each of the 3 places where the folder changed.
<add name="connectionName" connectionString="metadata=res://*/Model.MyModel.csdl|res://*/Model.MyModel.ssdl|res://*/Model.MyModel.msl;provider=System.Data.SqlClient;provider connection string="data source=server;initial catalog=myDataBase;user id=us;password=***;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
Take a look at this question, the problem seems to be the same.
Related
Project:
ASP.NET 4.5.2
MVC 5
Visual Studio 2015 (latest)
When building the project, today it mysteriously began erroring out with the error in the title. Now, it is not the build which is failing, but the publish:
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
Now, I have gone into the temp build folder, at
[path to project]\obj\Release\AspnetCompileMerge\Source
And it seems to have all the files needed to push to the sandbox, but when I do so attempting to reach the site errors out with a massive message (50+ lines). Will append once I have them formatted.
Suggestions?
NOTE: Other projects still compile just fine. This is limited to this project, specifically.
NOTE 2: I have seen several requests to use aspnet_compiler.exe with the -errorstack flag in the commandline, but I have yet to figure out what the -v and -p flags mean, so I am currently unable to provide the output. I have never used the commandline for development before, so details would be appreciated.
UPDATE 1: I actually figured out the command, and this is what I got:
D:\[path to project]>aspnet_compiler.exe -errorstack -v /[project] -p D:\[path to project]\
Microsoft (R) ASP.NET Compilation Tool version 4.0.30319.33440
Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved.
D:\[path to project]\web.config(43): error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
[ConfigurationErrorsException]: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (D:\[path to project]\web.config line 43)
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.Configuration.RuntimeConfig.GetSectionObject(String sectionName)
at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
at System.Web.Configuration.RuntimeConfig.get_Compilation()
at MTConfigUtil.GetCompilationConfig(String vpath)
at System.Web.Compilation.BuildManager.IsBatchEnabledForDirectory(VirtualPath virtualDir)
at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath startingVirtualDir, IEnumerable`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath startingVirtualDir, IEnumerable`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCallback callback, IEnumerable`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback, Boolean forceCleanBuild)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback)
at System.Web.Compilation.Precompiler.Main(String[] args)
In particular, note:
This error can be caused by a virtual directory not being configured as an application in IIS. (D:\[path to project]\web.config line 43)
Problem is, the only thing in my Web.Config at that line is
<authentication mode="None" />
You see, because the IIS built into VS 2015 crashes every time I stop debugging, I set up IIS on Windows itself and just pointed it toward my project directory. But it was working just fine up until now. Could this be the issue?
EDIT 2: Commenting out line 43 in my Web.Config now throws this:
This error can be caused by a virtual directory not being configured as an application in IIS. (D:\[path to project]\web.config line 46)
Clearly there is something very, very strange. Considering I have published at least twice since I last changed my Web.Config.
Ended up doing a backup of the project, nuking it from orbit, repaving with a new blank project, adding back in all the required NuGet packages and then copying over from the backup all the files I had directly edited. Including all the Migrations files also helped, as it meant I could pick up with the DB right where I left off. The only thing I had to walk through with a fine-toothed comb was the Web.Config -- I wanted to make sure this was set up perfectly, so I hand-edited it like a surgeon doing brain surgery.
FYI, I coped everything over through the file system while the project was unloaded, and then “included into the project” anything I had previously created from scratch.
Not the ideal situation, but hey. This project is still under construction, so I lost just about an hour or two at the most doing the rebuild. The tough part was dumping my Team Services repository, as it wouldn’t accept the new project. I did this after I confirmed the new setup was working 100%, as I wasn’t too concerned about not being able to roll back beyond a certain date.
After refactoring a solution I had a file containing a commented out class, so it only had the using clauses and namespace set. It was using a namespace that was no longer in use by any files but may have been cached somehow so didn't immediately error.
Building didn't pick it up and it caused the aspnet_compiler exited with code 1 error plus a few other unrelated errors that weren't errors. Removing the empty class file fixed it. Also remove any old namespaces from Views/web.config.
This is my third post on ClickOnce, but each of them has its own subject so I hope nobody minds this. I'm urgently migrating the existing app to the new server. I publish a ClickOnce application to a server (online usage only, not for install), and if I try to execute it via web browsers, I get a message box saying "Cannot continue. The Application is improperly formatted. Contact the application vendor for assistance.", the detail log of which includes below; (I masked some strings in the URL by *, as it was private information)
PLATFORM VERSION INFO
Windows : 5.1.2600.196608 (Win32NT)
Common Language Runtime : 4.0.30319.1
System.Deployment.dll : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll : 4.0.30319.1 (RTMRel.030319-0100)
dfdll.dll : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll : 4.0.31106.0 (Main.031106-0000)
SOURCES
Deployment url: http://**.**.***.173:10080/*****/ClickOnce/*********.application?comid=*****&userjpname=************&userfullname=************&canregist=True&canmanage=True&systemid=0
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of http://**.**.***.173:10080/*****/ClickOnce/*********.application?comid=*****&userjpname=************&userfullname=************&canregist=True&canmanage=True&systemid=0 resulted in exception. Following failure messages were detected:
+ Exception reading manifest from http://**.**.***.173:10080/*****/ClickOnce/*********.application?comid=*****&userjpname=************&userfullname=************&canregist=True&canmanage=True&systemid=0: the manifest may not be valid or the file could not be opened.
+ Manifest XML signature is not valid.
+ The digital signature of the object did not verify.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [2012/07/24 13:16:39] : Activation of http://**.**.***.173:10080/*****/ClickOnce/*********.application?comid=*****&userjpname=************&userfullname=************&canregist=True&canmanage=True&systemid=0 has started.
ERROR DETAILS
Following errors were detected during this operation.
* [2012/07/24 13:16:39] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
- Exception reading manifest from http://**.**.***.173:10080/*****/ClickOnce/*********.application?comid=*****&userjpname=************&userfullname=************&canregist=True&canmanage=True&systemid=0: the manifest may not be valid or the file could not be opened.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
--- Inner Exception ---
System.Deployment.Application.InvalidDeploymentException (SignatureValidation)
- Manifest XML signature is not valid.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
--- Inner Exception ---
System.Security.Cryptography.CryptographicException
- The digital signature of the object did not verify.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Internal.CodeSigning.SignedCmiManifest.Verify(CmiManifestVerifyFlags verifyFlags)
at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.
My server address is http://**.**.***.173:10080, and a clickonce app is published in http://**.**.***.173:10080/*****/ClickOnce folder.
I assume it tried to find an application manifest file (.manifest) with these several weird parameters (or query strings?) such as comid, userjpname, userfullname, canregist, canmanage, True and systemid, and thus it returned an error.
In my deployment manifest file, the location of the application manifest file is specified as below. No idea where these parameters came from.
<dependentAssembly
dependencyType="install"
codebase="MYAPPNAME_9_9_9_99\MYAPPNAME.exe.manifest"
size="8532">
<assemblyIdentity
name="MYAPPNAME.exe"
version="1.0.1.43"
publicKeyToken="*************"
language="neutral"
processorArchitecture="msil"
type="win32" />
Did you try to sign the application and deployment manifests again?
Reading you description again, I'm a bit confused.
First you create an application manifest.
Then you sign it.
Then you create a deployment manifest and explicitly point it to your application manifest.
Then you sign this, too.
(btw: you have to do the signing part every time you change something.)
I have one project with a few sub projects in it. A few projects contain dotnetnuke modules. And I have committed this project to SVN repo. But now when I checkout version from SVN I have to manually copy module project to dotnetnuke/desktopModules directory. I am trying to find some shorter way for this :(
I follow solution from this question DotNetNuke and Subversion guidelines , but have no luck. I added nant.build file to my project with dotnetnuke modules. Navigate to it from command line and run 'nant' command, but I got following error :(
Unhandled Exception:
System.TypeInitializationException:
The type initializer fo r
'NAnt.Console.ConsoleStub' threw an
exception. --->
System.Security.SecurityEx ception:
Request for the permission of type
'System.Security.Permissions.FileIOP
ermission, mscorlib, Version=4.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c5619 34e089'
failed. at
System.Security.CodeAccessSecurityEngine.Check(Object
demand, StackCrawlMa rk& stackMark,
Boolean isPermSet) at
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, S tackCrawlMark& stackMark) at
System.Security.CodeAccessPermission.Demand()
at
System.AppDomainSetup.VerifyDir(String
dir, Boolean normalize) at
System.AppDomain.get_BaseDirectory()
at
log4net.Config.XmlConfiguratorAttribute.Configure(Assembly
sourceAssembly, ILoggerRepository
targetRepository) at
log4net.Core.DefaultRepositorySelector.ConfigureRepository(Assembly
assemb ly, ILoggerRepository
repository) at
log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly
repositor yAssembly, Type
repositoryType, String repositoryName,
Boolean readAssemblyAttri butes) at
log4net.Core.DefaultRepositorySelector.CreateRepository(Assembly
repositor yAssembly, Type
repositoryType) at
log4net.Core.DefaultRepositorySelector.GetRepository(Assembly
repositoryAs sembly) at
log4net.Core.LoggerManager.GetLogger(Assembly
repositoryAssembly, String n ame)
at
log4net.LogManager.GetLogger(Assembly
repositoryAssembly, String name) at
log4net.LogManager.GetLogger(Type
type) at
NAnt.Console.ConsoleStub..cctor()
--- End of inner exception stack trace --- at NAnt.Console.ConsoleStub.Main(String[]
args)
To address your first point, if you map your source control repository directly to your website's desktopmodules folder, you won't need to copy it manually after getting latest.
For the second point, you may need to unblock the files being used by NAnt or look into using a different version of NAnt that does not have this issue. Alternatively, you can look into using MSBuild scripts instead of NAnt.
If I run this command on my system
<Exec Command="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler -v localhost -p $(SourceDir)\wwwroot -u -f projectCompileCode\project -c -errorstack -nologo" />
I get the following error:
error ASPParse: Could not load the type: Projectname:SomeFile.
The project is web application project
This my stack trace:
[HttpException]: Could not load type 'ProjectName.FileName'.
at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCa
e, Boolean throwOnError)
at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeN
me, String codeFileBaseTypeName, String src, Assembly assembly)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDicti
nary parseData)
[HttpParseException]: Could not load type ''ProjectName.FileName.
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virt
alPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseReader(StreamReader reader, VirtualP
th virtualPath)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPat
virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType(
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(
uildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResu
t(Boolean isPrecompiledApp)
at System.Web.Compilation.BuildManager.CompileGlobalAsax()
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath
tartingVirtualDir)
at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath starting
irtualDir)
at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCa
lback callback)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManag
rCallback callback)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManag
rCallback callback)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(Client
uildManagerCallback callback, Boolean forceCleanBuild)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(Client
uildManagerCallback callback)
at System.Web.Compilation.Precompiler.Main(String[] args)
If I build in v2.0.50727 then still it is giving the same error.
My application is built in with VS 2010, .net frame asp.net frame work 4
Any help is greatly apperciated.
Have you tried:
Checking references
Doing a clean and a build
Checking the Inherits attr in the HTML against the code behind
Creating a new App Pool in IIS for this web site?
I see a similar problem. Works locally from within VS2008, but once published and deployed to the server, I get the same error as described here.
None of the suggestions I have provided worked for me; maybe they will work for you.
I had the same error. When I opened the web site DLL in ILDASM, the Type for a control was completely missing, as if it didn't even get compiled.
As it turns out, the codebehind files got excluded from the project. This is strange considering that the builds on my machine were successful! At any rate, I carefully re-included codebehind files and it all started working.
This often happens because the project file (.csproj or .vbproj) does not contain the necessary references to the files in question. Try cleaning/rebuilding all projects and making sure that the latest project files are moved to the server as well.
Another possibility is that the file was not actually included in your project at all. This allows the builds in Visual Studio to run just fine, but will break when compiling the .NET code (with aspnet_compiler for example) because all .aspx/.ascx/etc. files within the specified folder are compiled - whether they are included in your project or not.
This has worked fine locally for months and just broke on deployment to the server (discountasp). I'm developing with .net 3.5 and asp.net mvc. I've previously successfully hosted asp.net mvc applications on this same account (but without the config section).
I have a custom config section set up in my web.config file that's causing the following error on load:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: An error occurred creating the configuration section handler for SCConfig: The system cannot find the file specified.
Source Error:
Line 179:
Line 180: <SCConfig>
Line 181: <authentication>
Line 182: <groups Administrators="Administrator" Auditors="Auditor" Auditor_Supervisors="Auditor Supervisor" Auditor_Externals="External Auditor" Biz_Users="Business User"/>
Source File: E:\web\irstagelert\htdocs\web.config Line: 180
Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074
The part of the web.config where I define the config handler is:
<section name="SCConfig" type="com.lerteco.SoxCompliance.ConfigHandler.CustomTagHandler, com.lerteco.SoxCompliance.ConfigHandler"/>
I've played with a few different iterations of the type, but they all produce the same error message as above.
The top of the class file is:
namespace com.lerteco.SoxCompliance.ConfigHandler
{
[Flags]
public enum GroupCodes
{
....
}
public class CustomTagHandler : IConfigurationSectionHandler
{
public object Create(object parent, object configContext, XmlNode section)
{
And I've confirmed that on the host the /bin/ directory contains both the com.lerteco.SoxCompliance.ConfigHandler.dll and ....pdb files.
Thanks for any help,
James
Jacob was right; it wasn't the handler file itself, but an error being generated from within the handler.
I ended up writing code and moving around return statements until I found the problem.
Specifically, I created an RSACrytpoServiceProvider() and got the error detailed in this posting RSACryptoServiceProvider CryptographicException System Cannot Find the File Specified under ASP.NET .
James