Καλησπέρα σε όλους,
Έχω ένα προβληματάκι όταν πάω να κάνω attach μία βάση στον SQL Server από μια Web Form.
Το πρόβλημα προκύπτει όταν το application γίνετε Publish στον IIS. Σε development περιβάλλον δουλεύει κανονικά.
Ο κώδικας για Attach :
public bool AttachDb(string serverName)
{
string mdf = HttpContext.Current.Server.MapPath("~/App_Data/eDB.mdf");
string ldf = HttpContext.Current.Server.MapPath("~/App_Data/eDB_log.ldf");
try
{
Server mServer = new Server(serverName);
mServer.AttachDatabase("eDB", new StringCollection { mdf, ldf }, AttachOptions.None);
}
catch (Exception)
{
return false;
}
return true;
}
Στον IIS παίρνω ένα Access Denied error αλλά δεν μπορώ να καταλάβω που ακριβώς θέλει access...ο IIS στον SQL Server?
Browser ERROR :
Server Error in '/AppName' Application.
Access is denied.
Description: An
error occurred while accessing the resources required to serve this
request. The server may not be configured for access to the requested
URL.
Error message 401.2.: Unauthorized:
Logon failed due to server configuration. Verify that you have
permission to view this directory or page based on the credentials you
supplied and the authentication methods enabled on the Web server.
Contact the Web server's administrator for additional assistance.
Όποιος έχει κάποια ιδέα ας την ρίξει. Ευχαριστώ.