zoukankan      html  css  js  c++  java
  • 解决:Unable to open the physical file "…….ldf". Operating system error 5: "5(拒绝访问。)".

            使用IIS发布网站后,用浏览器访问涉及到与系统自动生成的数据库ASPNETDB.MDF交互的页面时,弹出以下错误:

    Unable to open the physical file "E:\Asp.NET\MyWebsite\App_Data\aspnetdb_log.ldf". Operating system error 5: "5(拒绝访问。)".
    An attempt to attach an auto-named database for file E:\Asp.NET\MyWebsite\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

    说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

    异常详细信息: System.Data.SqlClient.SqlException: Unable to open the physical file "E:\Asp.NET\MyWebsite\App_Data\aspnetdb_log.ldf". Operating system error 5: "5(拒绝访问。)".
    An attempt to attach an auto-named database for file E:\Asp.NET\MyWebsite\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

    源错误: 

    行 64:     public virtual System.Collections.ArrayList ProId {
    行 65:         get {
    行 66:             return ((System.Collections.ArrayList)(this.GetPropertyValue("ProId")));
    行 67:         }
    行 68:         set {


    源文件: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\1dab7029\5fc82d96\App_Code.fxbt3ib8.1.cs     行: 66 


            在网上搜了很长时间,有网友认为是网站的路径问题。我的网站目录放在E盘,使用IIS默认网站的路径指向这个站点,但IIS只对C盘有所有控制权限,所以访问时会出现这样的错误。我将网站复制到C盘Intput目录后,将默认网站的路径改为C盘下的网站,再重新访问,这个错误就没有出现了。


            这个问题解决后,又出现了另一个错误Failed to update database "C:\INETPUB\MySite\APP_DATA\ASPNETDB.MDF" because the database is read-only.又去搜了半天,终于解决了,原来是App_Data文件夹的权限问题,解决方法参考我的上一篇博文:http://blog.csdn.net/yangsai2010/article/details/8961651

  • 相关阅读:
    Python动态展示遗传算法求解TSP旅行商问题
    MOEAD算法中均匀权向量的实现---Python
    HDU 5294 多校第一场1007题 最短路+最小割
    POJ 3261 Milk Patterns sa+二分
    HDU 4292 FOOD 2012 ACM/ICPC Asia Regional Chengdu Online
    CodeForces 201A Clear Symmetry
    POJ 1679 The Unique MST 确定MST是否唯一
    POJ 3268 Silver Cow Party 最短路 基础题
    POJ 2139 SIx Degrees of Cowvin Bacon 最短路 水題
    POJ2229 Sumsets 基礎DP
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/3093441.html
Copyright © 2011-2022 走看看