cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
apenaranda
Helper IV
Helper IV

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

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

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 Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

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!