none
Publishing a database project from Visual Studio 2017 RRS feed

  • Question

  • I am trying to understand how the Publisher works, so that I can understand whats going wrong.

    The project published OK and I installed on another PC, it installed the SQL server and my project without any errors, but when I tried to use the project and use the data I get an exception:

    System.Data.SqlClient.SqlException (0x80131904): The target principal name is incorrect.  Cannot generate SSPI context.

    My first thought is that it is to do with the Data source, as the project had my datasource details.

    I need to understand how a project of this type works and how the database that I used in the Visual Studio is copied and used in the published project.

    Out of curiousity I loaded MSSMS on the recipient computer, I could not detect a database, even though SQL LocalDB 2012 was loaded.

    Can one of you experts help me understand and fix this problem, as I have spent 100's of hours creating this project and I am failing at the last hardle.


    TEH

    Friday, July 26, 2019 7:27 PM

All replies

  • Hi,

    Please check if the following discussion solve your case:
    https://stackoverflow.com/questions/32309922/the-target-principal-name-is-incorrect-cannot-generate-sspi-context


    signature   Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]    [Linkedin]

    Saturday, August 3, 2019 7:49 AM
    Moderator
  • I have moved on from my last post!

    It was suggested that I use a LocalDB,on another forum, so I have tried that.

    Firstly, I was not aware that LocalDB dosn't retain the database file once the computer is shutdown.

    I know how to manually start the LocalDB and add the data, but I have no experience in writing or what files are needed to acheive loading and publishing of the necessary files onto a host PC.

    Can someone please list the steps needed to achieve my goal, with examples if possible?


    TEH



    • Edited by Rocky48 Monday, August 5, 2019 2:36 PM
    Monday, August 5, 2019 11:02 AM
  • I have moved on from my last post!

    It was suggested that I use a LocalDB,on another forum, so I have tried that.

    Firstly, I was not aware that LocalDB dosn't retain the database file once the computer is shutdown.

    I know how to manually start the LocalDB and add the data, but I have no experience in writing or what files are needed to acheive loading and publishing of the necessary files onto a host PC.

    Can someone please list the steps needed to achieve my goal, with examples if possible?


    TEH

    Hi,

    >> It was suggested that I use a LocalDB

    I am wondering why🙄

    It might be a result of misunderstanding...

    SQL Server Express LocalDB is a feature of SQL Server Express targeted to developers. It can be used for production but it was not meant for this and in most cases this is really bad idea to use LocalDB for production IMO.

    >> I know how to manually start the LocalDB and add the data, but I have no experience in writing or what files are needed to acheive loading and publishing of the necessary files onto a host PC.

    To connect to a specific database you need to use the file name in the connection string similar to:
    Server=(LocalDB)\MSSQLLocalDB; Integrated Security=true ;AttachDbFileName=D:\Data\MyDB1.mdf.


    signature   Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]    [Linkedin]

    Tuesday, August 6, 2019 9:45 AM
    Moderator
  • I am getting conflicting views from different sources?

    All I want do is publish my program with the database that it needs.

    I can see now how you can attach the file, but what file do I have to write in the publisher to get the files onto the new user PC.

    I keep finding on the web about using a BootStrapper file, is the file I need to write to acheive my goal?

    Due to my lack of expeince I did not know about the SQL Server database Project type in VS. I unerstand that this makes publishing a project with a database much simpler!  Would it be easy to change the project type without to much hassle?


    TEH


    • Edited by Rocky48 Tuesday, August 6, 2019 10:36 AM Comments added
    Tuesday, August 6, 2019 10:26 AM
  • Changed the Data Source to:

    "Data Source=LocalDB\.;AttachDbFileName=C:\Data\My_Greetings_Data.mdf;Integrated Security=True"
    This is where a copy of my database is located.

    This is the resulting error:

    I found thatI had 2 local DB's so I deleted one (Ver 13 & Ver 14).

    Still got the same error!

    Wondered if you had to start the server in cmd.exe,so I did, still the same error!

    What am I doing wrong?



    TEH

    Friday, August 9, 2019 3:31 PM