| Author |
Message |
mwg
Guest
|
Posted:
Fri Nov 11, 2005 1:51 am Post subject:
C# and System.Data.SqlClient.SqlException |
|
|
I am trying to write a basic c# windows application in visual studio. I
am basing this code on the Sharepoint Products & Technologies Resource
Kit.
When I execute this code:
Uri url = new Uri("http://spsservername");
TopologyManager topology = new TopologyManager();
PortalSite portal = topology.PortalSites[url];
I get this error (clipped from QuickWatch when I inspect
"topology.PortalSites[url]"):
- topology.PortalSites[url] {System.Data.SqlClient.SqlException} System.Data.SqlClient.SqlException
+ System.SystemException {@"Login failed for user
'DOMAIN\username'."} System.SystemException
+ _errors {System.Data.SqlClient.SqlErrorCollection} System.Data.SqlClient.SqlErrorCollection
Class 14 byte
+ Errors {System.Data.SqlClient.SqlErrorCollection} System.Data.SqlClient.SqlErrorCollection
LineNumber 0 int
Message @"Login failed for user 'DOMAIN\username'." string
Number 18456 int
Procedure "" string
Server "sqlservername" string
Source ".Net SqlClient Data Provider" string
State 1 byte
Any suggestions for where to look for an explanation?
Here are some other factors:
I am an administrator on the SPS server, but I don't have access rights
to the SQL server with my account. The DOMAIN\username above is my
personal login name, not the domain account used on the portal's
application pool?
Why isn't portal using the correct domain account? I can write web
parts without any problems and access the portal without problems.
Thanks in advance. |
|
| Back to top |
|
 |
Brad Covelle
Guest
|
Posted:
Sat Nov 12, 2005 1:50 am Post subject:
Re: C# and System.Data.SqlClient.SqlException |
|
|
If you are running the code under your username, and you don't have the same
rights as the user who is configured to run the SharePoint App Pool, you
won't have rights to do this. Try running it as an admin just to see what
happens or impersonating the app pool account in your code.
--
Brad Covelle
NuSoft Solutions
bcovelle@nusoftsolutions.com
http://blogs.sagestone.net/bcovell |
|
| Back to top |
|
 |
mwg
Guest
|
Posted:
Sat Nov 12, 2005 1:50 pm Post subject:
Re: C# and System.Data.SqlClient.SqlException |
|
|
You are correct, I added myself to the database as a reader/writer and
all is well now, however, this isn't an appropriate solution for a
production environment. Should I be handling this in code
(impersonation?) or through .NET security configuration? |
|
| Back to top |
|
 |
|
|
|
|