Print Page | Close Window

Error in Implementing IDataSourceKeyResolver

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2293
Printed Date: 29-Jul-2026 at 6:19am


Topic: Error in Implementing IDataSourceKeyResolver
Posted By: yafei
Subject: Error in Implementing IDataSourceKeyResolver
Date Posted: 10-Nov-2010 at 6:27pm
It's working when I debug/run in the local machine for the IDataSourceKeyResolver.  EDMKey has been created and returned and the EntityManager is generated without any problem. However, when I deploy to a seperate IIS 7.0 and call it from my local WinClient, the BOS server always throw exception below. It looks that the IDataSourceKeyResolver implemented class does not get the Database server name which are read from the configuration file.
 
Caught exception: System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) 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.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) --- End of inner exception stack trace --- at IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor.HandleException(Exception e, PersistenceFailure failureType) at IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor.OnExecuteQuery() at IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor.Execute(IEntityQuery entityQuery, SessionBundle sessionBundle, IEntityServer entityServer) at IdeaBlade.EntityModel.Server.EntityServer.Fetch(SessionBundle sessionBundle, IEntityQuerySurrogate surrogate) at SyncInvokeFetch(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
 



Replies:
Posted By: yafei
Date Posted: 11-Nov-2010 at 4:09pm

This issue is working fine now. However, I get a few questions for the implementation of EntityService and EntityServer. In the document online about the EntityService and EntityServers, I find:

--------------------------------------------------------------------------------
Extensions and EntityServers

Let’s stick with the multi-tenant, ASP scenario for awhile.

When the application client determines the customer, it creates an EntityManager dedicated to the data sources applicable to that customer by including the customer’s “DatasourceExtension” name in the constructor.

C# msManager = new DomainModelEntityManager(true, "A"); // Connect to customer "A"
VB msManager = New DomainModelEntityManager(True, "A") ' Connect to customer "A"

Now the client application tries to login or fetch entities with this EntityManager. The EntityManager contacts the EntityService. The EntityService checks among its EntityServers for one that is associated with extension “A”. It doesn’t find one so it creates a new EntityServer instance for extension “A” and adds it to its collection. This EntityServer now serves every EntityManager presenting the “A” extension.

When the EntityService encounters EntityManagers with unknown extensions – “B” and “C” for example –, it creates more EntityServers. The three-tenant scenario could look like this:

 
-----------------------------------------------------------------
In IIS 7.0, to make all these EntityServers work, I need to create multiple files like EntityServer_A.svc, EntityServer_B.svc, EntityServer_C.svc ... etc., because my WinClient is looking for it when it create an EntityManager (with Extension A, B, C ...). Is there another way to work this out to void so many files in server side? If I have 1000 customers, should I create 1000 files in IIS ?
 
 


Posted By: kimj
Date Posted: 11-Nov-2010 at 5:08pm
In DevForce 2010 we register a "virtual path provider" in the global.asax application startup logic to handle any requests to EntityService.svc or EntityServer*.svc .  With the virtual path provider in place you don't need physical .svc files at all, so it's particularly useful when using data source extensions.  As long as you have the global.asax logic in place, you don't need to do anything special for data source extensions, and you don't need any .svc files.



Print Page | Close Window