Home All Groups Group Topic Archive Search About

Login error when opening a deployed project

Author
6 Nov 2006 5:20 PM
chris
I've developed a Windows Forms Application in Visual Studio 2003. I
built an MSI package using the setup and deployment projects setup
wizard. I ran the MSI package on my machine (where I developed the
application) to install it and I can run the application just fine. I
deployed it on another machine but when I ran the application I get an
error: Login Failed for user OFFICE\Display Wenzl. I have Sub Main as
my startup project and this is the code:

    Sub Main()
        Dim currentUser As WindowsIdentity =
WindowsIdentity.GetCurrent()

AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
        If (Thread.CurrentPrincipal.IsInRole("OFFICE\PMS_Admin")) Or
(Thread.CurrentPrincipal.IsInRole("OFFICE\PMS_Users")) Then
            Dim switch As New realSwitchboard
            switch.ShowDialog()

        Else
            Dim sales As New realSwitchboardSales
            sales.ShowDialog()
        End If
    End Sub

The user belongs in the PMS_Admin group. This is the error message I
get:

System.Data.SqlClient.SqlException: Login failed for user
'OFFICE\Display Wenzl'.
   at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
   at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
options, Boolean& isInTransaction)
   at System.Data.SqlClient.SqlConnection.Open()
   at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection
connection, ConnectionState& originalState)
   at System.Data.Common.DbDataAdapter.FillFromCommand(Object data,
Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
   at PMS.realSwitchboard.FillOptions()
   at PMS.realSwitchboard.realSwitchboard_Load(Object sender, EventArgs
e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean
fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

I've tried deploying on other machines but I get the same "Login
Failed" error. What am I doing wrong?

Thanks in advance!

Christine

Author
6 Nov 2006 6:20 PM
chris
I just noticed that if I add the user to the Built In administrators
group, the application works perfectly fine. Obviously I don't want to
put every user in the administrators group, so how would I get around
this?
Thanks,
Chris

chris wrote:
Show quoteHide quote
> I've developed a Windows Forms Application in Visual Studio 2003. I
> built an MSI package using the setup and deployment projects setup
> wizard. I ran the MSI package on my machine (where I developed the
> application) to install it and I can run the application just fine. I
> deployed it on another machine but when I ran the application I get an
> error: Login Failed for user OFFICE\Display Wenzl. I have Sub Main as
> my startup project and this is the code:
>
>     Sub Main()
>         Dim currentUser As WindowsIdentity =
> WindowsIdentity.GetCurrent()
>
> AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
>         If (Thread.CurrentPrincipal.IsInRole("OFFICE\PMS_Admin")) Or
> (Thread.CurrentPrincipal.IsInRole("OFFICE\PMS_Users")) Then
>             Dim switch As New realSwitchboard
>             switch.ShowDialog()
>
>         Else
>             Dim sales As New realSwitchboardSales
>             sales.ShowDialog()
>         End If
>     End Sub
>
> The user belongs in the PMS_Admin group. This is the error message I
> get:
>
> System.Data.SqlClient.SqlException: Login failed for user
> 'OFFICE\Display Wenzl'.
>    at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
> isInTransaction)
>    at
> System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
> options, Boolean& isInTransaction)
>    at System.Data.SqlClient.SqlConnection.Open()
>    at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection
> connection, ConnectionState& originalState)
>    at System.Data.Common.DbDataAdapter.FillFromCommand(Object data,
> Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
> command, CommandBehavior behavior)
>    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> CommandBehavior behavior)
>    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
>    at PMS.realSwitchboard.FillOptions()
>    at PMS.realSwitchboard.realSwitchboard_Load(Object sender, EventArgs
> e)
>    at System.Windows.Forms.Form.OnLoad(EventArgs e)
>    at System.Windows.Forms.Form.OnCreateControl()
>    at System.Windows.Forms.Control.CreateControl(Boolean
> fIgnoreVisible)
>    at System.Windows.Forms.Control.CreateControl()
>    at System.Windows.Forms.Control.WmShowWindow(Message& m)
>    at System.Windows.Forms.Control.WndProc(Message& m)
>    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
>    at System.Windows.Forms.ContainerControl.WndProc(Message& m)
>    at System.Windows.Forms.Form.WmShowWindow(Message& m)
>    at System.Windows.Forms.Form.WndProc(Message& m)
>    at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
>    at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
>    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
> msg, IntPtr wparam, IntPtr lparam)
>
> I've tried deploying on other machines but I get the same "Login
> Failed" error. What am I doing wrong?
>
> Thanks in advance!
>
> Christine
Author
6 Nov 2006 6:29 PM
Claus Konrad [MCSD]
You should use SQL Authentication instead of Windows Authentication.
If you keep to Windows Authentication; you could include the Domain Users as
allowed users, but I would without shaddow of a doubt go for the Sql
Authentication solution.
--
rgds.
/Claus Konrad
MCSD.NET (C#)


Show quoteHide quote
"chris" wrote:

> I just noticed that if I add the user to the Built In administrators
> group, the application works perfectly fine. Obviously I don't want to
> put every user in the administrators group, so how would I get around
> this?
> Thanks,
> Chris
>
> chris wrote:
> > I've developed a Windows Forms Application in Visual Studio 2003. I
> > built an MSI package using the setup and deployment projects setup
> > wizard. I ran the MSI package on my machine (where I developed the
> > application) to install it and I can run the application just fine. I
> > deployed it on another machine but when I ran the application I get an
> > error: Login Failed for user OFFICE\Display Wenzl. I have Sub Main as
> > my startup project and this is the code:
> >
> >     Sub Main()
> >         Dim currentUser As WindowsIdentity =
> > WindowsIdentity.GetCurrent()
> >
> > AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
> >         If (Thread.CurrentPrincipal.IsInRole("OFFICE\PMS_Admin")) Or
> > (Thread.CurrentPrincipal.IsInRole("OFFICE\PMS_Users")) Then
> >             Dim switch As New realSwitchboard
> >             switch.ShowDialog()
> >
> >         Else
> >             Dim sales As New realSwitchboardSales
> >             sales.ShowDialog()
> >         End If
> >     End Sub
> >
> > The user belongs in the PMS_Admin group. This is the error message I
> > get:
> >
> > System.Data.SqlClient.SqlException: Login failed for user
> > 'OFFICE\Display Wenzl'.
> >    at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
> > isInTransaction)
> >    at
> > System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
> > options, Boolean& isInTransaction)
> >    at System.Data.SqlClient.SqlConnection.Open()
> >    at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection
> > connection, ConnectionState& originalState)
> >    at System.Data.Common.DbDataAdapter.FillFromCommand(Object data,
> > Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
> > command, CommandBehavior behavior)
> >    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
> > startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> > CommandBehavior behavior)
> >    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
> >    at PMS.realSwitchboard.FillOptions()
> >    at PMS.realSwitchboard.realSwitchboard_Load(Object sender, EventArgs
> > e)
> >    at System.Windows.Forms.Form.OnLoad(EventArgs e)
> >    at System.Windows.Forms.Form.OnCreateControl()
> >    at System.Windows.Forms.Control.CreateControl(Boolean
> > fIgnoreVisible)
> >    at System.Windows.Forms.Control.CreateControl()
> >    at System.Windows.Forms.Control.WmShowWindow(Message& m)
> >    at System.Windows.Forms.Control.WndProc(Message& m)
> >    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
> >    at System.Windows.Forms.ContainerControl.WndProc(Message& m)
> >    at System.Windows.Forms.Form.WmShowWindow(Message& m)
> >    at System.Windows.Forms.Form.WndProc(Message& m)
> >    at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
> >    at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
> >    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
> > msg, IntPtr wparam, IntPtr lparam)
> >
> > I've tried deploying on other machines but I get the same "Login
> > Failed" error. What am I doing wrong?
> >
> > Thanks in advance!
> >
> > Christine
>
>
Author
8 Nov 2006 5:54 PM
chris
I am using Trusted_Connection = True, I don't know if that's the same
as Integrated Security = True. However I took your advice and am using
SQL authentication instead and it works fine now. Thank you!

Claus wrote:
Show quoteHide quote
> You should use SQL Authentication instead of Windows Authentication.
> If you keep to Windows Authentication; you could include the Domain Users as
> allowed users, but I would without shaddow of a doubt go for the Sql
> Authentication solution.
> --
> rgds.
> /Claus Konrad
> MCSD.NET (C#)
>
>
> "chris" wrote:
>
> > I just noticed that if I add the user to the Built In administrators
> > group, the application works perfectly fine. Obviously I don't want to
> > put every user in the administrators group, so how would I get around
> > this?
> > Thanks,
> > Chris
> >
> > chris wrote:
> > > I've developed a Windows Forms Application in Visual Studio 2003. I
> > > built an MSI package using the setup and deployment projects setup
> > > wizard. I ran the MSI package on my machine (where I developed the
> > > application) to install it and I can run the application just fine. I
> > > deployed it on another machine but when I ran the application I get an
> > > error: Login Failed for user OFFICE\Display Wenzl. I have Sub Main as
> > > my startup project and this is the code:
> > >
> > >     Sub Main()
> > >         Dim currentUser As WindowsIdentity =
> > > WindowsIdentity.GetCurrent()
> > >
> > > AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
> > >         If (Thread.CurrentPrincipal.IsInRole("OFFICE\PMS_Admin")) Or
> > > (Thread.CurrentPrincipal.IsInRole("OFFICE\PMS_Users")) Then
> > >             Dim switch As New realSwitchboard
> > >             switch.ShowDialog()
> > >
> > >         Else
> > >             Dim sales As New realSwitchboardSales
> > >             sales.ShowDialog()
> > >         End If
> > >     End Sub
> > >
> > > The user belongs in the PMS_Admin group. This is the error message I
> > > get:
> > >
> > > System.Data.SqlClient.SqlException: Login failed for user
> > > 'OFFICE\Display Wenzl'.
> > >    at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
> > > isInTransaction)
> > >    at
> > > System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
> > > options, Boolean& isInTransaction)
> > >    at System.Data.SqlClient.SqlConnection.Open()
> > >    at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection
> > > connection, ConnectionState& originalState)
> > >    at System.Data.Common.DbDataAdapter.FillFromCommand(Object data,
> > > Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
> > > command, CommandBehavior behavior)
> > >    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
> > > startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> > > CommandBehavior behavior)
> > >    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
> > >    at PMS.realSwitchboard.FillOptions()
> > >    at PMS.realSwitchboard.realSwitchboard_Load(Object sender, EventArgs
> > > e)
> > >    at System.Windows.Forms.Form.OnLoad(EventArgs e)
> > >    at System.Windows.Forms.Form.OnCreateControl()
> > >    at System.Windows.Forms.Control.CreateControl(Boolean
> > > fIgnoreVisible)
> > >    at System.Windows.Forms.Control.CreateControl()
> > >    at System.Windows.Forms.Control.WmShowWindow(Message& m)
> > >    at System.Windows.Forms.Control.WndProc(Message& m)
> > >    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
> > >    at System.Windows.Forms.ContainerControl.WndProc(Message& m)
> > >    at System.Windows.Forms.Form.WmShowWindow(Message& m)
> > >    at System.Windows.Forms.Form.WndProc(Message& m)
> > >    at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
> > >    at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
> > >    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
> > > msg, IntPtr wparam, IntPtr lparam)
> > >
> > > I've tried deploying on other machines but I get the same "Login
> > > Failed" error. What am I doing wrong?
> > >
> > > Thanks in advance!
> > >
> > > Christine
> >
> >
Author
6 Nov 2006 6:23 PM
Claus Konrad [MCSD]
From the exception (sqlException), it is implied that you are most likely
using a connectionstring with 'Integrated Security = true'? Am I correct?

If yes - the current user ('OFFICE\Display Wenzl') is not allowed access to
the database. It is a Sql database login error you are seeing.
--
rgds.
/Claus Konrad
MCSD.NET (C#)


Show quoteHide quote
"chris" wrote:

> I've developed a Windows Forms Application in Visual Studio 2003. I
> built an MSI package using the setup and deployment projects setup
> wizard. I ran the MSI package on my machine (where I developed the
> application) to install it and I can run the application just fine. I
> deployed it on another machine but when I ran the application I get an
> error: Login Failed for user OFFICE\Display Wenzl. I have Sub Main as
> my startup project and this is the code:
>
>     Sub Main()
>         Dim currentUser As WindowsIdentity =
> WindowsIdentity.GetCurrent()
>
> AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
>         If (Thread.CurrentPrincipal.IsInRole("OFFICE\PMS_Admin")) Or
> (Thread.CurrentPrincipal.IsInRole("OFFICE\PMS_Users")) Then
>             Dim switch As New realSwitchboard
>             switch.ShowDialog()
>
>         Else
>             Dim sales As New realSwitchboardSales
>             sales.ShowDialog()
>         End If
>     End Sub
>
> The user belongs in the PMS_Admin group. This is the error message I
> get:
>
> System.Data.SqlClient.SqlException: Login failed for user
> 'OFFICE\Display Wenzl'.
>    at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
> isInTransaction)
>    at
> System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
> options, Boolean& isInTransaction)
>    at System.Data.SqlClient.SqlConnection.Open()
>    at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection
> connection, ConnectionState& originalState)
>    at System.Data.Common.DbDataAdapter.FillFromCommand(Object data,
> Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
> command, CommandBehavior behavior)
>    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> CommandBehavior behavior)
>    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
>    at PMS.realSwitchboard.FillOptions()
>    at PMS.realSwitchboard.realSwitchboard_Load(Object sender, EventArgs
> e)
>    at System.Windows.Forms.Form.OnLoad(EventArgs e)
>    at System.Windows.Forms.Form.OnCreateControl()
>    at System.Windows.Forms.Control.CreateControl(Boolean
> fIgnoreVisible)
>    at System.Windows.Forms.Control.CreateControl()
>    at System.Windows.Forms.Control.WmShowWindow(Message& m)
>    at System.Windows.Forms.Control.WndProc(Message& m)
>    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
>    at System.Windows.Forms.ContainerControl.WndProc(Message& m)
>    at System.Windows.Forms.Form.WmShowWindow(Message& m)
>    at System.Windows.Forms.Form.WndProc(Message& m)
>    at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
>    at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
>    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
> msg, IntPtr wparam, IntPtr lparam)
>
> I've tried deploying on other machines but I get the same "Login
> Failed" error. What am I doing wrong?
>
> Thanks in advance!
>
> Christine
>
>