Error on running a WCF workflow application after installation of AppFabric
appfabric, wcf, workflow-foundation-4
Solution
The AppFabric configuration tool updates the web.config file in at this location only
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
When building with the "Any CPU" option as I was you must manually edit this file
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config
With these settings (from the Framework64 version)
<connectionStrings>
<add connectionString="Data Source=(local);Initial Catalog=AppFabricMonitoringDB;Integrated Security=True" name="ApplicationServerMonitoringConnectionString" providerName="System.Data.SqlClient" />
<add connectionString="Data Source=(local);Initial Catalog=AppFabricPersistenceDB;Integrated Security=True" name="ApplicationServerWorkflowInstanceStoreConnectionString" providerName="System.Data.SqlClient" />
</connectionStrings>
They were previously set to the default
<connectionStrings>
<add connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=AppFabricMonitoringDB;Integrated Security=True" name="ApplicationServerMonitoringConnectionString" providerName="System.Data.SqlClient" />
<add connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=AppFabricPersistenceDB;Integrated Security=True" name="ApplicationServerWorkflowInstanceStoreConnectionString" providerName="System.Data.SqlClient" />
</connectionStrings>
Problem
I have installed Windows Server AppFabric and I can now not run even the most basic WCF Workflow Service Application. I have gone through the configuration and setup databases for the persistence store, monitor and cache which worked ok. So I have stripped it back and just created and run an empty WCF Workflow Service Application. When I click on the Service1.xaml file I get the error below. I have checked the databases and I have dbowner access to all of them (have substituted my real logon details here). I am using VS2010 with .NET 4 update 1. Server Error in '/' Application. Cannot open database "AppFabricPersistenceDB" requested by the login. The login failed. Login failed for user 'mydomain\myusername'. 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. Details ``` Exception Details: System.Data.SqlClient.SqlException: Cannot open database "AppFabricPersistenceDB" requested by the login. The login failed. Login failed for user 'mydomain\myusername'. 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: [SqlException (0x80131904): Cannot open database "AppFabricPersistenceDB" requested by the login. The login failed. Login failed for user 'mydomain\myusername'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5064458 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +183 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +239 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +195 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +232 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +33 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +524 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +479 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126 System.Data.SqlClient.SqlConnection.Open() +125 System.Activities.DurableInstancing.SqlCommandAsyncResult.StartCommandInternal(Boolean synchronous) +557 System.Activities.DurableInstancing.SqlWorkflowInstanceStoreAsyncResult.StartOperation() +377 [InstancePersistenceCommandException: The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}CreateWorkflowOwner was interrupted by an error.] System.Runtime.AsyncResult.End(IAsyncResult result) +688590 System.Runtime.DurableInstancing.InstancePersistenceContext.OuterExecute(InstanceHandle initialInstanceHandle, InstancePersistenceCommand command, Transaction transaction, TimeSpan timeout) +78 System.Runtime.DurableInstancing.InstanceStore.Execute(InstanceHandle handle, InstancePersistenceCommand command, TimeSpan timeout) +82 System.ServiceModel.Activities.Dispatcher.DurableInstanceManager.Open(TimeSpan timeout) +294 [CommunicationException: The InstanceStore could not be initialized.] System.ServiceModel.Activities.Dispatcher.DurableInstanceManager.Open(TimeSpan timeout) +394 System.ServiceModel.Activities.WorkflowServiceHost.OnOpen(TimeSpan timeout) +105 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +318 System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +206 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +651 [ServiceActivationException: The service '/Service1.xamlx' cannot be activated due to an exception during compilation. The exception message is: The InstanceStore could not be initialized..] System.Runtime.AsyncResult.End(IAsyncResult result) +688590 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService) +234 System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +379 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272 ```