Base solution for your next web application
Open Closed

Does ASP.NET Zero use ASP Role Management? #1948


User avatar
0
sparkyjr created

I have been deploying our ASP.NET Zero project to Azure without problems for a while now. For last few days all deployments have started failing with error "SQLExpress database file auto-creation error: ", where it looks like the Azure system is trying to connect to a local database. Upon debugging it seems like this is happening only for authenticated pages. The login page shows up as expected, and login failures also happen. But as soon as authentication is successful, it seems a different DB is getting accessed.

Here is my current connection string in web.config

<add name="Default" connectionString="Data Source=xxx.database.windows.net,1433;Database=XYDB;User ID=xxx;Password=yyy;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />

Looks like the system for some reason might be reverting to the LocalSqlServer connection string in machine.config. When I add the following

<remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=xxx.database.windows.net,1433;Database=XYDB;User ID=xxx;Password=yyy;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />

The error now changes to "Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'. "

Makes me wonder whether the ASPNet Zero is indeed using the ASP default role management? Is there a way I can disable it if it is not used? As this seems to be happening out of the blue, I am also thinking if this is because of some action on the Azure side. Any help is appreciated


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

    Hi,

    Starting from the end..

    <remove name="LocalSqlServer" />
        <add name="LocalSqlServer" connectionString="Data Source=xxx.database.windows.net,1433;Database=XYDB;User ID=xxx;Password=yyy;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />
    

    This will be always problem since AspNet Zero looks for the "Default" connection string, but you defined "LocalSqlServer" (defined here: <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/dev/src/MyCompanyName.AbpZeroTemplate.EntityFramework/AbpZeroTemplateDataModule.cs#L20">https://github.com/aspnetzero/aspnet-ze ... ule.cs#L20</a>).

    AspNet Zero does not use ASP role management. It uses ASP.NET Identity (<a class="postlink" href="https://www.asp.net/identity">https://www.asp.net/identity</a>). I could not understand the reason of your problem. Could you solve it?

  • User Avatar
    0
    sparkyjr created

    This turned out to be a red herring. There were some reference changes that were applied to the Web project. It was for some new feature that we were experimenting on. Rolling it back (from csproj) fixed the issue for us.