asp.net web service Cannot connect to the configuration database

G

Guest

hellow i need to get sharepoint user credentials, in order to get this
information i'm using the next code. in a C# web service

SPSite site = new SPSite("http://sharepoint/");
SPWeb web = site.OpenWeb();
string cadena = web.CurrentUser.LoginName;

when i run the web service i get this error

Cannot connect to the configuration database

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Cannot
connect to the configuration database.

Source Error:


Line 45: SPSite site = new SPSite("http://sharepoint/");
Line 46: SPWeb web = site.OpenWeb();
Line 47: string cadena = web.CurrentUser.LoginName;

it shows me the error is on line 47 but i really can't find what is my error.

any help would be appreciate.

thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top