More in this section

Forums / Deployment / Database always being attached as 'master' when AttachDbFileName is used

Database always being attached as 'master' when AttachDbFileName is used

2 posts, 0 answered
  1. Robert
    Robert avatar
    70 posts
    05 Feb 2009
    29 Mar 2013
    Link to this post
    I'm trying to put my project to shared hosting and use mdf on file system as DB.
    This is my connection string:

            <add connectionString="Database=podnikajmecom;data source=.\SQLEXPRESS;AttachDBFileName=|DataDirectory|sf_podnikajme_com.mdf;Integrated Security=SSPI;" providerName="System.Data.SqlClient;Trusted_Connection=Yes;UserInstance=True;" dbType="MsSql" name="Sitefinity" />

    despite of 'Database=' I always get this error message:

    Cannot attach the file 'W:\domains\\public\www_root\App_Data\sf_podnikajme_com.mdf' as database 'master'.

    Seems to me like Database= is ignored. Anyone has an idea? 
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    18 Sep 2017
    03 Apr 2013
    Link to this post

    The user who must have access to the database with permissions over the database (database owner) must be added over the .mdf database. I suppose the shared hosting have access to SQL server to attach the database and assign a database user to be used as a user to manage the database. For example here is how sitefinity database is assigned a database user on shared hosting with assigning permissions to the database.

    All the best,
    Richard Moore
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered