Re: C# and System.Data.SqlClient.SqlException

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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@xxxxxxxxxxxxxxxxxxx
http://blogs.sagestone.net/bcovell


"mwg" <Maury.Gallaher@xxxxxxxxx> wrote in message
news:1131662454.254827.55280@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>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.
>


.



Relevant Pages

  • Re: Active Directory Account Creation Mode does not work
    ... The IIS application pool must have rights in the nominated OU. ... that the app pool must be running under a domain account, not network or ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Service wont start as a non-Power User account
    ... user that the service runs under doesn't have rights to do it. ... > admin privileges. ... The setup asks the user for a domain account to use run ... > Power User on the machine, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: XP security tab - group or user names odd entry
    ... Partly anyway - can't tell you why the rights are not removed with the user, ... connection - when you've got a good connection to your DC's, ... It was a string of digits ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Local admin domain user
    ... You have the right Idea except this will give the user admin rights when ... They will not get admin rights when logging on to the ... need to attach these rights to their domain account. ...
    (microsoft.public.win2000.security)
  • Re: Sts Access
    ... I've read through the entire thread and SharePoint Team Services hasn't been ... Use a domain account that have sa rights to the ... Created sql sa account with sysadmin rights on remote sql server ...
    (microsoft.public.sharepoint.windowsservices)