Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
apenaranda
Post Patron
Post Patron

web.config file in hosting

Hello,
I have in visual studio the program "RowLevelSecurityDemo" which embeds powerbi and you can create different roles.
In the web.config file I have it as follows:

 

  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=WSPC\SQLPOWERBI;database=xxxxx; Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>

 

So it works perfectly for me on my pc, it creates the DB and everything runs fine.
The issue where I have problems is when I want to publish it on my website, I am not very clear about what procedure I have to do.
I have tried to publish first on my pc so that it would create the files for me and then upload them via ftp to my website, but it does not work. I think the problem lies with the DB
Could you help me in the part of how I publish it and the program accesses the DB (in my hosting I have the possibility of creating SQL DB)?
Thanks.

 

3 REPLIES 3
apenaranda
Post Patron
Post Patron

Actually the connectionStrings is correct but what I want is that it does not create the database, which is the error that I get earlier. I want to directly create the tables...
I don't understand much but I think it does it in these lines although I don't know very well in which part it creates the database

 

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
    {
        public ApplicationDbContext()
            : base("DefaultConnection", throwIfV1Schema: false)
        {
            Database.SetInitializer(new IdentityDropCreateInitializer());
        }

        public static ApplicationDbContext Create()
        {
            return new ApplicationDbContext();
        }
    }

    public class IdentityDropCreateInitializer :
      DropCreateDatabaseAlways<ApplicationDbContext>
    {
apenaranda
Post Patron
Post Patron

thanks for the answer but I have already done all that, as I said before, the program is already done with the roles and such but now I want it to be able to be executed on a web.
The problem I had before with connectionStrings seems to have been more or less solved, but now the problem is that the program creates the database every time it is executed, and the hosting database engine tells me that the database is already created and I can not continue.
On localhost there were no problems running the program.

 

apenaranda_0-1662537872041.png

 

v-chenwuz-msft
Community Support
Community Support

Hi @apenaranda ,

 

It seems that you are looking for information about if and when to deploy rls to an existing dataset.
Then you should probably configure the gateway first to make sure the dataset can connect to your database.

 

If you have already configured gateway, then please refer to the following article to deploy rls.

https://docs.microsoft.com/en-us/power-bi/developer/embedded/cloud-rls 

 

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.