cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
apenaranda
Helper V
Helper V

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
Helper V
Helper V

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
Helper V
Helper V

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.