I had an requirement to Create Database through windows service, when first time service will run,when i am running Create Db Script from WPF application it successfully create database but same script when i am running from Windows service i am getting error "CREATE DATABASE permission denied in database 'master'.
2条答案
按热度按时间llycmphe1#
The Windows service account needs to be a member of the SQL Server sysadmin role or the db_creator server role in order to create databases. Adding the below script to your script may help you.
swvgeqrz2#
You may be running into an administrator issue.
Before opening the program, right click on it and run it as administrator.
Hopefully this should solve your problem.