How to solve this problem?
I am using asp.net 2.0, vs2005 and IIS 5.1.
Using Windows XP SP3.
Failed to access IIS metabase.
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.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HostingEnvironmentException: Failed to access IIS metabase.]
System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path) +3591442
System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath2.MapPath(String siteID, VirtualPath vpath) +9
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +169
System.Web.CachedPathData.GetConfigPathData(String configPath) +389
System.Web.CachedPathData.GetConfigPathData(String configPath) +243
System.Web.CachedPathData.GetApplicationPathData() +68
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +3536567
System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(VirtualPath path) +189
The rights of the ASPNET user have not been set correctly.
What version of ASP.NET are you running?
try
Start -> Run
Type cmd <HIT RETURN>
Type c:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i <HIT RETURN>
or as suggested
aspnet_regiis.exe -ga ASPNET
Running asnet_regiis with the -i option might not be enough, as the reason might be the lack of proper IIS Metabase access rights for ASPNET account.
I would suggest running it with the -ga option:
aspnet_regiis.exe -ga ASPNET
As a general comment, this issue will occur if one installs Visual Studio and/or the .Net Framework before installing IIS.
try running aspnet_regiis -i from the dotnet directory. It has a way of fixing things.
Simply run the following from the cmd
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
Related
I found this error after publishing the site on the server.
I tried a lot to solve this problem from my side but nothing works for me.
I have tried to update all those packages with the latest and still does not work for me.
But, it works well when I run a project in Visual Studio without any problems.
I have checked these 2 links to fix my problem but it still doesn't work for me.
Specified Web Pages version “3.0.0.0” could not be found. Update your web.config to specify a different version. Current version: “2.0.0.0”
Update your web.config to specify a different version?
However, I tried to install the downgraded (older) version and I got a 404 error code, the resource could not be found.
Also, I have checked all the web config files where the version has been declared and it seems right for me.
I don't know what I should do with this error message.
It would be nice if someone could help me with this.
Server Error in '/' Application.
Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0".
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.InvalidOperationException: Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0".
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0".]
System.Web.WebPages.Deployment.PreApplicationStartCode.StartCore(IFileSystem fileSystem, String appDomainAppPath, String binDirectory, NameValueCollection appSettings, IEnumerable1 loadedAssemblies, IBuildManager buildManager, Action1 loadWebPages, Action registerForChangeNotification, Func`2 getAssemblyNameThunk) +21268
System.Web.WebPages.Deployment.PreApplicationStartCode.StartCore() +245
[InvalidOperationException: The pre-application start initialization method Start on type System.Web.WebPages.Deployment.PreApplicationStartCode threw an exception with the following error message: Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0"..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection1 methods, Func1 setHostingEnvironmentCultures) +890
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +167
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +133
System.Web.Compilation.BuildManager.ExecutePreAppStart() +178
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +746
[HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.WebPages.Deployment.PreApplicationStartCode threw an exception with the following error message: Specified Web Pages version "3.0.0.0" could not be found. Update your web.config to specify a different version. Current version: "2.0.0.0"..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +552
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +122
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +737
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4261.0
My .net project (Any CPU) is referring to Oracle.dataaccess x86 version . In my local GAC the odac version is x86. But in the web server where it was installed previously was having AMB64 version of odac in GAC . The site was working without any problem . Now I need to move the site to AWS .The windows instance in AWS has the below configuration.
OS version : Microsoft windows server 2012 R2 Standard .
IIS 8.5
The server is clean and does not have any software installed .
When I try to create a site , I ended up seeing **could not load file or assembly one of its dependencies **. Through forums I installed various libraries from Oracle but I don't understand what are the exact steps needed . I was just doing trial and error.
Please let me know the software or steps to follow which needs do be installed such that my .net site which is connecting to its Oracle database works .
Edit 1 :
Hi ,
I performed the following steps .
As suggested by you I added Oracle.managedDataaccess dll(x86) . It worked well in my local.
Deployed the same code in the server.
I installed the oracle_12.1.0.1.0
In C:/oracle_12.1.0.1.0/odp.net/managed/x86 I ran the bat file for configuring the managed odac in the server. I was able to see the changes in the machine.config file .
5.Now when I ran the site I got the below error .
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.TypeInitializationException: The type initializer for
'Oracle.DataAccess.Client.OracleClientFactory' threw an exception.
---> System.DllNotFoundException: Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT:
0x8007007E) at
Oracle.DataAccess.Client.OpsInit.CheckVersionCompatibility(String
version) at Oracle.DataAccess.Client.OracleInit.Initialize() at
Oracle.DataAccess.Client.OracleClientFactory..cctor() --- End of
inner exception stack trace --- --- End of inner exception stack
trace --- at System.RuntimeFieldHandle.GetValue(RtFieldInfo field,
Object instance, RuntimeType fieldType, RuntimeType declaringType,
Boolean& domainInitialized) at
System.Reflection.RtFieldInfo.UnsafeGetValue(Object obj) at
System.Reflection.RtFieldInfo.GetValue(Object obj) at
System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
at
System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings
appConfigConnection) at
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String
name, AppConfig config) at
System.Data.Entity.Internal.LazyInternalConnection.Initialize() at
System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Sample.Data.AbstractEFUnitOfWork2.SetClientId(String clientId)
at Sample.Web.Controllers.ApiControllerBase1..ctor(IUow uow,
IConnectionManager cm, IEnumerable`1 allowedAppUserbases, String
connectionName, Boolean allowSaves)
In order to fix this I added OraOps12 dll from c:/oracle_12.1.0.1.0/bin to the wwwroot/site/bin folder. Then I got the below error .
System.ArgumentException: Unable to find the requested .Net Framework
Data Provider. It may not be installed. at
System.Data.Common.DbProviderFactories.GetFactory(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings
appConfigConnection) at
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String
name, AppConfig config) at
System.Data.Entity.Internal.LazyInternalConnection.Initialize() at
System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Sample.Data.AbstractEFUnitOfWork2.SetClientId(String clientId)
at Sample.Web.Controllers.ApiControllerBase1..ctor(IUow uow,
IConnectionManager cm, IEnumerable`1 allowedAppUserbases, String
connectionName, Boolean allowSaves)
Checking to resolve this .
Appreciate your suggestions.
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.
When i deploy my web project after publishing, on IIS. it gives me the following error.
Server Error in '/' Application.
Could not load file or assembly 'System.Web' or one of its dependencies. The system cannot find the file specified.
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.FileNotFoundException: Could not load file or assembly 'System.Web' or one of its dependencies. The system cannot find the file specified.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Try the following (If using 64 bit IIS - replace framework by framework 64):-
Run command prompt as admin.
2a. If using version 3.5 Type
cd c:\windows\microsoft.net\framework\v2.0.50727
and press enter.
2b. If using version 4.0 or 4.5 type
cd c:\windows\microsoft.net\framework\v4.0.30319
and press enter.
3. Type
aspnet_regiis -i
and press enter.
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.