System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.

W

weird0

This is the exception that I get when i create a webserivce obj and
call. The error comes on the webmethod call, when it opens a
connection to the db.

How do I fix it? What is the solution to this?

System.Web.Services.Protocols.SoapException: Server was unable to
process request. ---> System.Data.SqlClient.SqlException: An attempt
to attach an auto-named database for file g:\inetpub\wwwroot
\BankingService\App_Data\BankingDb.mdf failed. A database with the
same name exists, or specified file cannot be opened, or it is located
on UNC share.

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,
SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
at
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean
enlistOK)
at
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection
owningObject, SqlConnectionString connectionOptions, String
newPassword, Boolean redirectedUserInstance)
at
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, Object providerInfo,
String newPassword, SqlConnection owningObject, Boolean
redirectedUserInstance)
at
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool,
DbConnection owningConnection)
at
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection
owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at BankingService.CheckPincode(String Pincode) in g:\Inetpub\wwwroot
\BankingService\App_Code\Service.cs:line 123
 
N

Nicholas Paldino [.NET/C# MVP]

The MDF file BankingDb, does a database with that name already exist on
the server you are trying to run this off of?
 
W

weird0

Hi! Like you pointed a different format for the connectionstring that
i am using to run the webservice locally...

server=machineName;database=yourdbname;uid=whatever;pwd=pass;

Here is the connectionstring that i am using inside the code both for
client of webservice and website for asp.net location. And it does not
work for webserivce:

public static string connectionString = @"Data .
\SQLEXPRESS;AttachDbFilename=|DataDirectory|\BankingDb.mdf;Integrated
Security=True;User Instance=True";

What should be my connectionstring coz i dont think i have a username
and password for my db. Here is what i guess
it should be what you told? Is it correct? Can i just write
DataDirectory or do I have to specify the exact directory where the
database lies like on the desktop?

public static string connectionString = @"server=localhost;server=g:
\Documents and Setting\s2188\Desktop\App_Data
\BankingDb.mdf;User Instance=True";
 

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

Top