
Wednesday, April 14, 2010
c# System Event logging

Saturday, April 10, 2010
Deploying a C# WCF project as an installable service:
1) Create a new WCF Service Library
2) Add a new Windows Service project to the solution
a. Right click on Service1.cs and select view code and modify the OnStart and OnStop to startup and stop your WCF
b. Double click on Service1.cs
a. Right click in the window and select “Add Installer”
b. You should now see serviceinstall1 and serviceprocessinstaller1
Check the properties under these two and modify as required.
3) Add a new project “Setup Project” to your solution.
a. Right click on the project and select Add and then Project Output
b. Select your Windows service project and select Primary Output and hit OK
c. Right click on the project and select View and then Custom Actions
d. Right click on custom actions and select Add Custom Action
Double click on Application Folder and select your primary output and hit ok
After you build the “Setup Project” you will be able to run the “msi” file to install your service anywhere.
Friday, April 9, 2010
Steps for SSIS impersonation in SSMS
1) (Security -> Logins) Have a login with appropriate permissions
2) (Security -> Credentials) Create a credential and associate it with a Domain account
3) (SQL Server Agent -> Proxies) Create a new proxy and associate it with the new Credential
Under “Activate the following subsystems”
a) Select “Operating System”
b) Select “SSIS package”
4) (Security -> Logins) Select properties of our user and check “Map to credential” and add our credential
5) (SQL Server Agent -> Jobs) Select properties of your job then select steps and then edit and under Run As select our new credential
Impersonating the current Windows user
SQL server 2008 seems to make life much easier with integrated security so that us DBA s no longer have to manage passwords. All we have to do is setup what AD groups have which permissions on whatever tables.
I use the following code when accessing a SQL server database with Integrated security so that I can control user permissions through AD groups and accounts based on what credentials are currently in use.
using (((WindowsIdentity)User.Identity).Impersonate()) {
// SQL statements
}