Καλώς ορίσατε στο dotNETZone.gr - Σύνδεση | Εγγραφή | Βοήθεια
σε

 

Αρχική σελίδα Ιστολόγια Συζητήσεις Εκθέσεις Φωτογραφιών Αρχειοθήκες

Πρόβλημα Attach Database Σε Web Application

Îåêßíçóå áðü ôï ìÝëïò Τάσκος Γιώργος. Τελευταία δημοσίευση από το μέλος Τάσκος Γιώργος στις 21-09-2009, 23:05. Υπάρχουν 5 απαντήσεις.
Ταξινόμηση Δημοσιεύσεων: Προηγούμενο Επόμενο
  •  21-09-2009, 15:18 53871

    Πρόβλημα Attach Database Σε Web Application

    Καλησπέρα σε όλους,

    Έχω ένα προβληματάκι όταν πάω να κάνω 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.

    Όποιος έχει κάποια ιδέα ας την ρίξει. Ευχαριστώ.

  •  21-09-2009, 15:55 53872 σε απάντηση της 53871

    Απ: Πρόβλημα Attach Database Σε Web Application

    Γιώργο για ρίξε μια ματιά εδώ. http://forums.iis.net/t/1152085.aspx Συγκεκριμένα σε ένα post ένα τύπος λέει το εξής: 
    "401.2 means that your server and the browser are following 2 different authentication protocols.... are you entering any sort of credentials for accessing this resource??? 
  •  21-09-2009, 16:26 53873 σε απάντηση της 53872

    Απ: Πρόβλημα Attach Database Σε Web Application

    Νομίζω ότι ίσως έδωσες λύση, πρέπει να το δώ στο σπίτι.
    Μόλις σκέφτηκα ότι δεν είχα λάβει υπόψην ότι έχω Authentication στην σελίδα, και όταν την δουλεύω
    το έχω <allow users="*">. Πρέπει να βγάλω εκτός την Web Form από το Authentication.

    Dummy...

    Θα το κλείσω μόλις το εξακριβώσω 100%...thanx man.

  •  21-09-2009, 20:45 53875 σε απάντηση της 53873

    Απ: Πρόβλημα Attach Database Σε Web Application

    Μπα, τζίφος, δεν μπόρεσα να το καταφέρω. Μέσα από το Visual Studio δουλεύει κανονικά...



  •  21-09-2009, 21:24 53876 σε απάντηση της 53875

    Απ: Πρόβλημα Attach Database Σε Web Application

    Γιατί δεν χρησιμοποιείς το SQL Server Hosting Toolkit; Υπάρχει και για VS2008. Ένα πιο αναλυτικό tutorial έχει γράψει ο Scott Guthrie.
    Ακόμα κι ένας άνθρωπος μπορεί ν' αλλάξει τον κόσμο. Μη θέλεις να κυβερνήσεις. Απλά δείξε το μονοπάτι κι ο κόσμος θ' ακολουθήσει!!
  •  21-09-2009, 23:05 53877 σε απάντηση της 53876

    Απ: Πρόβλημα Attach Database Σε Web Application

    Markos:
    Γιατί δεν χρησιμοποιείς το SQL Server Hosting Toolkit; Υπάρχει και για VS2008. Ένα πιο αναλυτικό tutorial έχει γράψει ο Scott Guthrie.

    Καλό, thanx.


Προβολή Τροφοδοσίας RSS με μορφή XML
Με χρήση του Community Server (Commercial Edition), από την Telligent Systems