Word document error - asp.net-mvc-2

I am trying use a Word document from my application on a Windows 2008 server 64bit from my MVC 2 application. I encountered this error message:
System.UnauthorizedAccessException: Retrieving the COM class factory
for component with CLSID {000209FF-0000-0000-C000-000000000046} failed
due to the following error: 80070005 Access is denied. (Exception from
HRESULT: 0x80070005 (E_ACCESSDENIED)).
at
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
publicOnly, Boolean noCheck, Boolean& canBeCached,
RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
skipCheckThis, Boolean fillCache)
at
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly,
Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean
fillCache)
at System.Activator.CreateInstance(Type type, Boolean
nonPublic).
I have tried all know solutions, but still cannot fix it.

First of all, please note that serverside office interop isn't
officially supported by Microsoft:
http://support.microsoft.com/kb/257757
Nevertheless I got a similar scenario running with power point and had to do the following steps to get rid of the error you describe:
Run Microsoft Management Console (mmc.exe)
Add Snap-In for "Component Services"
Search for Computers\My Computer\DCOM Config\Microsoft Office Power Point Slide\ (you may search for something that sounds correct for your word-scenario)
Open Properties > Tab "Security"
"Launch and Activation Permissions" > Edit ...
Add your application pool user to this list and allow "Local Launch" and "Local Activation"

Related

Unexpected exception chain after updating EF 6.x

I updated from EF6.2 to EF6.4 and I encountered this exception chain:
[VerificationException: Operation could destabilize the runtime.]
System.Data.Entity.Core.Metadata.Edm.FacetDescription.Validate(String declaringTypeName) +70
System.Data.Entity.Core.Metadata.Edm.FacetDescription..ctor(String facetName, EdmType facetType, Nullable`1 minValue, Nullable`1 maxValue, Object defaultValue, Boolean isConstant, String declaringTypeName) +103
System.Data.Entity.Core.SchemaObjectModel.FacetDescriptionElement.CreateAndValidateFacetDescription(String declaringTypeName) +115
System.Data.Entity.Core.SchemaObjectModel.TypeElement.ResolveTopLevelNames() +119
System.Data.Entity.Core.SchemaObjectModel.Schema.ResolveTopLevelNames() +206
System.Data.Entity.Core.SchemaObjectModel.Schema.Resolve() +16
System.Data.Entity.Core.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, AttributeValueNotification providerNotification, AttributeValueNotification providerManifestTokenNotification, ProviderManifestNeeded providerManifestNeeded, IList`1& schemaCollection) +554
System.Data.Entity.Core.SchemaObjectModel.SchemaManager.ParseAndValidate(IEnumerable`1 xmlReaders, IEnumerable`1 sourceFilePaths, SchemaDataModelOption dataModel, DbProviderManifest providerManifest, IList`1& schemaCollection) +156
System.Data.Entity.Core.SchemaObjectModel.SchemaManager.LoadProviderManifest(XmlReader xmlReader, String location, Boolean checkForSystemNamespace, Schema& schema) +151
System.Data.Entity.Core.Common.DbXmlEnabledProviderManifest.Load(XmlReader reader) +75
System.Data.Entity.Core.Common.DbXmlEnabledProviderManifest..ctor(XmlReader reader) +116
System.Data.Entity.SqlServer.SqlProviderManifest..ctor(String manifestToken) +37
System.Data.Entity.SqlServer.<>c.<GetDbProviderManifest>b__29_0(String s) +25
System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +65
System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifest(String versionHint) +125
System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifest(String manifestToken) +55
[ProviderIncompatibleException: The provider did not return a ProviderManifest instance.]
System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifest(String manifestToken) +187
System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +119
System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +43
System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +159
System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +124
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +678
System.Data.Entity.Internal.InternalContext.Initialize() +20
Website.Db.Context..ctor(DbConnection Connection) in Context.vb:15
Website._Default.GetNewsItems() in Default.aspx.vb:13
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +191
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
lambda_method(Closure , MethodInfo , Object , Object[] ) +39
System.Web.UI.WebControls.ModelDataSourceView.InvokeMethod(ModelDataSourceMethod method, Boolean isAsyncMethod) +326
System.Web.UI.WebControls.ModelDataSourceView.InvokeMethod(ModelDataSourceMethod method) +7
System.Web.UI.WebControls.ModelDataSourceView.GetSelectMethodResult(DataSourceSelectArguments arguments) +68
System.Web.UI.WebControls.ModelDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +14
System.Web.UI.WebControls.Repeater.GetData() +233
System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +207
System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +62
System.Web.UI.WebControls.Repeater.DataBind() +131
System.Web.UI.WebControls.Repeater.EnsureDataBound() +114
System.Web.UI.WebControls.Repeater.OnPreRender(EventArgs e) +16
System.Web.UI.Control.PreRenderRecursiveInternal() +166
System.Web.UI.Control.PreRenderRecursiveInternal() +236
System.Web.UI.Control.PreRenderRecursiveInternal() +236
System.Web.UI.Control.PreRenderRecursiveInternal() +236
System.Web.UI.Control.PreRenderRecursiveInternal() +236
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4722
Here's line 15 of Context.vb:
Database.SetInitializer(New MigrateDatabaseToLatestVersion(Of Context, Migrations.Configuration))
A pretty straightforward database call, I'd say.
However, when I bumped back down to EF6.2, the error stopped.
I'm finding plenty of references to the individual exceptions here on SO, but nothing I've found so far quite fits the context of the combination of the three taken together with what the code is doing (general database access).
Do I need to alter my DAL code somehow in order to accommodate the EF6.4 update? Were there some breaking changes?
--EDIT--
Running locally under an explicit setting of Medium Trust, I get a different chain:
[PolicyException: Execution permission cannot be acquired.]
System.Security.CodeAccessSecurityEngine.TryResolveGrantSet(Evidence evidence, PermissionSet& grantSet) +14092083
System.Security.CodeAccessSecurityEngine.ResolveGrantSet(Evidence evidence, Int32& specialFlags, Boolean checkExecutionPermission) +60
[FileLoadException: Could not load file or assembly 'Microsoft.WebTools.BrowserLink.Runtime, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. PolicyException thrown. (Exception from HRESULT: 0x80131416)]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +232
System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +176
System.Reflection.Assembly.LoadFrom(String assemblyFile) +53
Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader.GetRuntimeAssemblyFromSetupConfiguration(Assembly& runtime) +27
Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader.LoadRuntime() +26
Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader.PreApplicationStart() +45
[InvalidOperationException: The pre-application start initialization method PreApplicationStart on type Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader threw an exception with the following error message: Could not load file or assembly 'Microsoft.WebTools.BrowserLink.Runtime, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. PolicyException thrown. (Exception from HRESULT: 0x80131416).]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +919
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +169
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +172
System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +854
[HttpException (0x80004005): The pre-application start initialization method PreApplicationStart on type Microsoft.VisualStudio.Web.PageInspector.Runtime.Loader.RuntimeLoader threw an exception with the following error message: Could not load file or assembly 'Microsoft.WebTools.BrowserLink.Runtime, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. PolicyException thrown. (Exception from HRESULT: 0x80131416).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724
This occurs under both EF6.2 and EF6.4.
If this is occurring on your remote deployment and not your local development environment after upgrading the EF version then I would suspect there is an issue with the deployment process.
Check the web.config in the deployed build to ensure that there are no EF-related runtime version dependency version overrides. (EntityFramework.dll and EntityFramework.SqlServer.dll)
Check the EntityFramework.dll assembly version between the deployed file on the remote server and your working local instance.
Copy the deployment from the remote server into a local folder, point IIS at it and then hook VS up running your project using Attach to Process on w3wp.exe. Set a breakpoint somewhere in the code and check that it remains a "hot" hit-able breakpoint and not an inactive one stating something along the lines of "The breakpoint will not currently be hit. The source line does not match..." This would indicate that the deployed code does not reflect a current, complete rebuild of what you are running in VS.
If you are using an automated build:
Check that dependency DLLs are not being checked in and that the build machine is actively resolving NuGet packages properly.
Check your references for EF, both before you upgrade the EF version (Source control revert all changes, use what was last built and deployed) Under the project explorer under References, select EntityFramework and check the path listed. It should be pointing to:
{Your solution folder}\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll
If it is pointing to anything like a \bin\debug etc. folder, remove the reference and repair to point at the NuGet package.
If NuGet packages folder is checked in, make sure this folder is complete and up to date in source control. When checking in nuget folders (as opposed to package version locking) I find this needs to be done from Explorer / TFS as normal VS checkins won't include them in pending changes. (unlike /bin folder changes if you accommodate them.) package folder updates can be skipped when initial checkins were made but then things like .ignore files are added/updated causing newer .dll files not to be updated.
Check for any stale or mismatched project files (.csproj/.vbproj) in your local environment vs. what is in source control. Often these can get flagged at some point as "Excluded Files" resulting in the automated build using out of date references.
Have a check through these and see if that identifies anything.

Database from AlwaysOn availability group restored as normal database

I have a problem with a normal SQL database restored from a DB set in AlwaysOn high availability group in SQL Server 2017.
I restored a copy of production db to a different server, to be used as QA test database, with a different name also - MyDB_demo
The problem is, the QA app copy (same code as production with new development enhancements) get an error at some point.
Even if my conn str points to MyDB_demo, I get the following error
[SqlException (0x80131904): The target database ('MyDB') is in an availability group and is currently accessible for connections when the application intent is set to read only. For more information about application intent, see SQL Server Books Online.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action 1 wrapCloseInAction) +2444190
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action 1 wrapCloseInAction) +5775712
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +285
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4169
System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +58
System.Data.SqlClient.SqlDataReader.get_MetaData() +89
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption) +409
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +2127
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +911
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +64
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +240
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +41
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +12
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +139
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +136
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +88
MyApp.SqlHelper.ExecuteDataset(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters) +163
MyApp.PermitFunctions.GetSystemMessages(String sp, Int32 iPermitID, Int32 iAppID, SqlConnection cn) +219
MyApp.Municipality.LoadSystemMessage() +3869
MyApp.Municipality.Page_Load(Object sender, EventArgs e) +101
System.Web.UI.Control.OnLoad(EventArgs e) +95
System.Web.UI.Control.LoadRecursive() +59
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678
Is there any reference in the newly restored DB (named now MyDB_demo) that stores the original name of production DB and why is it trying to access it?
Any suggestion is appreciated.
EDIT
Actually, the server used to restore MyDB_demo is one of the secondary nodes for AlwasyOn availability group; it also contains a RO copy of production database, MyDB.
So the server has:
RO copy of production DB (MyDB)
normal, stand-alone db restored for QA - MyDB_demo
Hence, I understand the error message - it would makes sense if I tried to access directly the secondary, RO copy of production db from connection string.
But I do not: the connection string (which I double-checked) is trying to connect to QA db, MyDB_demo.
Here is some additional info:
the error is thrown in SQLHelper class, the helper class from MS to work with SQL Server, in the ExecuteDataset function
the error is thrown ONLY on one stored procedure - lot of other stored procedures and also direct SQL statements run just fine
I inspected the stored procedure, thinking it might contains accidentally a hardcoded reference to DB name - it doesn't
and the strange part - I run the stored procedure with the same parameters as called from the app in SSMS - and it run just fine - no error
So it looks somehow the connection string MIGHT be altered (!!!) is some way by the NET application itself, and only for this stored procedure?
Anyone ever encountered something like this?
Thank you
Due to the strange (read: stupid) situation that the culprit SP fails only when called from within app, but runs ok when tried in SSMS, I tried a "stupid" approach: I inspected its code, commented out two fields that were set with sub-selects like select top 1 from ..... where.... (actually I replaced theit values with dummy ones) and I changed an Order By field that was initially specified like "InspectionType" Desc, which I removed quotation marks from.
Doing this, the SP suddenly started to work ok even when called from the app.
Then I reverted all changes to original (added quoted back and put back the sub-selects) and the SP continued to work ok.
So ... problem solved.
Stupid approach for stupid problem (!?!?!)
In any case, if anyone has a better idea or explanation of what might have happened, I'd be glad to hear it
EDIT
I think I understand the fix.
By editing and saving the stored procedure, its query plan was recompiled.
So the original error might have been caused by the old query plan.
But why did it referenced the database name? Is the actual database name referenced in query plans? This looks a little odd to me.
And another question (open):
Does the SQL Server optimizer detect if a DB runs in high-availability mode, and when optimizing the queries, does it decide if a query is read-only mode and automatically redirects it toward a read-only node? Even if the ApplicationIntent readonly parameter is not present in connection string?
Because it was not in this case, even in production - we just implemented AlwaysOn functionality and are in the process of updating app to take advantage of R/O nodes.
Any comments are appreciated

Unavailable XRMServices/2011/Organization.svc

I try to discover service endpoint .../XRMServices/2011/Organization.svc and I've this error:
An error has occurred.
Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization's Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Crm.MainApplication.Application_Error(Object sender, EventArgs eventArguments)
Stack trace:
Error Description:
Generic SQL error.
Error Details:
Generic SQL error.
Full Stack:
[SqlException: Cannot open database "ASPState" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.]
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Web.SessionState.SqlSessionStateStore.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo, TimeSpan retryInterval)
[HttpException: Unable to connect to SQL Server session database.]
at System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e)
at System.Web.SessionState.SqlSessionStateStore.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo, TimeSpan retryInterval)
at System.Web.SessionState.SqlSessionStateStore.GetConnection(String id, Boolean& usePooling)
at System.Web.SessionState.SqlSessionStateStore.DoGet(HttpContext context, String id, Boolean getExclusive, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags)
at System.Web.SessionState.SqlSessionStateStore.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags)
at System.Web.SessionState.SessionStateModule.GetSessionStateItem()
at System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
What may cause the problem, what is wrong with CRM?
Since you are using NETWORK SERVICE, you need to make sure the webserver's computer account is added to the SQLAccessGroup in Active Directory. Normally this is done for you during CRM setup, but if you want to change the account later you must remember to add the new account to this group manually. Here is a link that describes the different groups that CRM uses:
http://ayazahmad.wordpress.com/2007/01/26/active-directory-security-groups-for-mscrm/
I've seen a similar message when the user did not have a role assigned, but that occured in a test enviroment, still worth checking.
I completely re-installed development stack and the same happened again, I re-installed my virtual machine and it worked, seems like it some unknown issue. Now I'll try to reproduce the same errors on a new instances of a virtual machine.
Thanks to all)
I have seen also this message on my CRM server. What I've done is to just enable and disable anonymous authentication on IIS, and thing worked for me. Also I've played with web.config, service settings, but later I get that section back as it was on first install of CRM.
In my oppinion, IIS doesn't tell WCF how to auth, and couple of cold restarts, and enabling and disabling anonymous auth. wake up WCF.
Your AppPool needs to be a User that has access to the database.
With regards to the WCF Service,
Check your IIS Website Authentication settings, for WCF Services you need
Anonymous Authentication Enabled
ASP.NET Impersonation Enabled
Windows Authentication Enabled
for On-Premise installation running in an AD environment.
We also had the issue and it was resolved after restarting IIS.

error CS0006: Metadata file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\...\some.dll' could not be found

I am experiencing this problem very often at my hosting server.
The error starts happening occasionally for random DLL and until I ftp the web.config file again (even the same file), the error goes and the site starts working fine.
I am posting the exception and stack trace below.
Please help...
Exception: error CS0006: Metadata file 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root...\some.dll' could not be found
Stack Trace: at System.Web.Compilation.BuildManager.PostProcessFoundBuildResult(BuildResult result, Boolean keyFromVPP, VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetBuildResultFromCacheInternal(String cacheKey, Boolean keyFromVPP, VirtualPath virtualPath, Int64 hashCode) at System.Web.Compilation.BuildManager.GetVPathBuildResultFromCacheInternal(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile) at System.Web.UI.BaseTemplateParser.GetUserControlType(VirtualPath virtualPath) at System.Web.UI.MainTagNameToTypeMapper.ProcessUserControlRegistration(UserControlRegisterEntry ucRegisterEntry) at System.Web.UI.MainTagNameToTypeMapper.TryUserControlRegisterDirectives(String tagName)
Mostly likely, you're forcing a recompile while the server is under load. This can have unpredictable effects. ASP.NET does dynamic recompilation, but if you're deploying multiple files you can get a geometric expansion of the nummber of dynamic recompiles required to swallow your whole code migration. Redeploying web.config probably kind of resets the compile process.
Recycling your app pool will clear such a problem, but you may lack that access. Deploying off-peak can probably mitigate the problem.
The best answer for this please open you web.config file and add below two setting add in the compilation tag
<compilation targetFramework="4.0" debug="false" batch="false">
Keep coidng, Also i tried following things when i get the same error in my application which i tried to host in the server
Click Start, click Run, type iisreset /stop, and then click OK.
Open the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary
ASP.NET Files directory.
Delete all files and all folders in the directory that you located
in step
Click Start, click Run, type iisreset /start, and then click OK.
Do a build again and then try to access your site.

How to fix “The ConnectionString property has not been initialized” in nopCommerce

I'm trying to integrate nopCommerce into a third party system but am hitting a problem when I try to access any nopCommerce pages. Because I'm integrating with a third party system I've had to merge web.configs and copy all files over. I have a standalone install of nopCommerce aswell and that is running fine.
Any help would be greatly appreciated.
The error I am getting is as follows:
The ConnectionString property has not been initialized.
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: The ConnectionString property has not been initialized.
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: The ConnectionString property has not been initialized.]
System.Data.SqlClient.SqlConnection.PermissionDemand() +5038498
System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) +20
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
System.Data.SqlClient.SqlConnection.Open() +125
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +52
[EntityException: The underlying provider failed on Open.]
System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +161
System.Data.EntityClient.EntityConnection.Open() +98
System.Data.Objects.ObjectContext.EnsureConnection() +81
System.Data.Objects.ObjectQuery1.GetResults(Nullable1 forMergeOption) +46
System.Data.Objects.ObjectQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +44
System.Linq.Enumerable.ToDictionary(IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer) +151
System.Linq.Enumerable.ToDictionary(IEnumerable1 source, Func`2 keySelector) +90
NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.SettingManager.GetAllSettings() +542
NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.SettingManager.GetSettingByName(String name) +121
NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.SettingManager.GetSettingValue(String name) +49
NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.SettingManager.GetSettingValueBoolean(String name, Boolean defaultValue) +54
NopSolutions.NopCommerce.BusinessLogic.Configuration.Settings.SettingManager.GetSettingValueBoolean(String name) +41
NopSolutions.NopCommerce.BusinessLogic.CustomerManagement.CustomerManager.get_UsernamesEnabled() +45
NopSolutions.NopCommerce.Web.Administration.LoginPage.ApplyLocalization() +108
NopSolutions.NopCommerce.Web.Administration.LoginPage.Page_Load(Object sender, EventArgs e) +40
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
NopSolutions.NopCommerce.Web.BaseNopAdministrationPage.OnLoad(EventArgs e) +44
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
You need to have a valid connection string.
After you pass the database installation phase (when you fill in the database settings) nop commerce is keeping the database information in a file that is not within the project, you can find it within the App_Data folder in the Presentation\Nop.Web\App_Data\ named Settings.txt, update it if you need and run the application again.
You need to have a valid connection string for the NopCommerce database in web.config, and you need to ensure that it gets read.
At Application_Start in global.asax NopCommerce reads in the connection string and injects it into the business logic DLL. If that doesn't happen, the data access layer (in the business logic DLL) won't be able to open a connection and you'll get the error you just posted. I suggest check web.config and global.asax; if both look good put a breakpoint in Application_Start.
The connection string is not held in the web.config file in nopcommerce... it is in the ConnectionStrings.config file. You might want to check for that file and copy it over if it is not there or put your connection string in there if the file is there and the string is not.