Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Getting error with Multi tenant – multi databases #1123


User avatar
0
Qloud created

Hello,

I have downloaded code and i have proceed with below steps. database is created but empty and getting error on tenant creation.

  1. Added master connection string on web.config
  2. Run Update-Database command.
  3. Now application is working perfectly with default tenant.
  4. Then creating tenant and i am passing connection string with credential and without credential also getting same error.

Server={servername};Database={dbname};User ID=sa;Password={password}; Server={localhost};Database={dbname};Trusted_Connection=true;

I have try with above two connection string. database created successfully. but not creating tenant on tenants table in master database.

I have followed this document. <a class="postlink" href="http://volosoft.com/aspnet-boilerplate-v0-9-and-aspnet-zero-v1-10-have-been-released/">http://volosoft.com/aspnet-boilerplate- ... -released/</a>

Do you have any other document? step by step?

Error (Stack trace) System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: MSDTC on server '{Server}' is unavailable. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest) at System.Data.SqlClient.TdsParser.GetDTCAddress(Int32 timeout, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlInternalConnectionTds.GetDTCAddress() at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx) at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx) at System.Data.SqlClient.SqlInternalConnectionTds.Activate(Transaction transaction) at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction) at System.Data.ProviderBase.DbConnectionPool.PrepareConnection(DbConnection owningObject, DbConnectionInternal obj, Transaction transaction) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultip...

Awaiting for your answer.

Thanks


15 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Have you seen the blog post we published for this release: <a class="postlink" href="http://volosoft.com/aspnet-boilerplate-v0-9-and-aspnet-zero-v1-10-have-been-released/">http://volosoft.com/aspnet-boilerplate- ... -released/</a>

    See the MSDTC section in the post:

    ABP uses transaction for each unit of work as default. If our UOW includes more than one database operation, then it becomes a distributed transaction. As you know, this may require MSDTC (Microsoft Distributed Transaction Coordinator) be enabled and running on the server.

  • User Avatar
    0
    Qloud created

    Hello Hikalkan,

    Thank you for your quick response.

    I got a step for enable MSDTC [https://technet.microsoft.com/en-us/library/cc759136%28v=ws.10%29.aspx]). but on last step they mention Hit the Security Configuration button in MSDTC tab. But in my windows 10 not available this option in MSDTC tab. please see attached.

    Can you please suggest me how we can enable MSDTC when we are on local development.

    Awaiting for your answer.

    Thanks,

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Instead of computer properties, just right click on the "Local DTC" then click properties. You will see security tab.

  • User Avatar
    0
    Qloud created

    Dear ismcagdas,

    As per hikalkan mention in documentation We have to enable MSDTC. not a DTC

    And when we right click on the "Local DTC" then click properties. then in security tab showing Network DTC Access.

    So may i know if i enable this option then Multi tenant – multi databases will work?

    Find attached for reference.

    Awaiting for your response.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Under the MSDTC tab, it says, "use local coordinator", that's why I redirected you to local dtc settings.

    But your local DTC security settings seems normal. Can you check if "Distributed Transaction Coordinator" windows service is running ?

  • User Avatar
    0
    Qloud created

    Hello ismcagdas,

    Yeah this service is already running on my system. Let me know the next step to resolve this issue.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I'm asking just be sure,

    Is your db server(s) and application server are same ? Because MSDTC must be enabled on all servers including app server and database server(s).

  • User Avatar
    0
    Qloud created

    Hello ismcagdas,,

    I am trying to run still on local system.. so yes my application is running on my visual studio and yeah sql server also on my same system.

    Let me know the next step to resolve this issue.

    Thanks

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    This is actually a problem non related to AspNet Zero. In your exception message, I see:

    "MSDTC on server '{Server}' is unavailable"

    What is {Server} in your connection string? I suspect that it's '{Server}', otherwise the exception would include the actual server name instead of placeholder.

  • User Avatar
    0
    Qloud created

    Hi Hikalkan,

    Basically we can't explore personal detail on forums that's why i put {Server}, {dbname}, {Password} like that.

    :)

  • User Avatar
    0
    maharatha created

    to add to this I was able to make it work on my laptop where IIS and DB are on the same machine . The moment I moved it to our development server where IIS and DB are in different server I start getting the issue discussed here.

    I tried all possible troubleshooting but still unable to resolve.

    FYI : The firewall is disabled.

  • User Avatar
    0
    maharatha created

    to add to it :

    I was using SQL Server 2016 and Windows Srver 2016. Now I tested with a SQL 2012 and Windows Server 2012 and it works fine

  • User Avatar
    0
    hikalkan created
    Support Team

    Can you disable transactions to better understand if it's related to that. In your Core module's PreInitialize:

    Configuration.UnitOfWork.IsTransactional = false;
    
  • User Avatar
    0
    Qloud created

    Hello Hikalkan,

    What is the solution for my issue?

  • User Avatar
    0
    Qloud created

    Hello,

    Here is the right solution for my issue.

    #1123

    Thank you Ismil, hikalkan and ismcagdas :)