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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors