簡體   English   中英

[Win32Exception(0x80004005):系統找不到指定的文件]

[英][Win32Exception (0x80004005): The system cannot find the file specified]

我正在開一個笑話網絡應用程序。

我使用C#,實體框架,MVC,我做代碼優先。

現在當我嘗試在我的數據庫中讀出一些內容時,我在標題中輸入的錯誤就出現了。 我不知道該尋找什么。 我抬頭看谷歌,但我沒有得到答案......

我嘗試提供您可能需要知道的所有代碼:

public class Context : DbContext
{
    public DbSet<Categorie> Categories {get;set;}

    public Context() : base("Witze_DB")
    {
    }
}

public class HomeController : Controller
{
    private Context db;

    public HomeController(Context db)
    {
        this.db = db;
    }

    public ActionResult Index()
    {
        var allCats = db.Categories;
        return View(allCats);
    }
}

這是Index.cshtml文件:

@model IEnumerable<Witze.Categorie>

@{
ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
    <th>
        @Html.DisplayNameFor(model => model.Name)
    </th>
    <th></th>
</tr>

@foreach (var item in Model) {
<tr>
    <td>
        @Html.DisplayFor(modelItem => item.Name)
    </td>
    <td>
        @Html.ActionLink("Edit", "Edit", new { id=item.CategorieId }) |
        @Html.ActionLink("Details", "Details", new { id=item.CategorieId }) |
        @Html.ActionLink("Delete", "Delete", new { id=item.CategorieId })
    </td>
</tr>
}

</table>

這就是我得到的回復:(它會更長,如果它確實有幫助,我會發布其余的,它只是更多的System.Data.SqlClient ...)

Server Error in '/' Application.
--------------------------------------------------------------------------------


 The system cannot find the file specified 
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.ComponentModel.Win32Exception: The system cannot find the file specified

Source Error: 





    Line 18:     </tr>
    Line 19: 
    Line 20: @foreach (var item in Model) {
    Line 21:     <tr>
    Line 22:         <td> 

Source File: c:\Users\a80815067.EISLAB\Documents\Visual Studio 2012\Projects\Witze_Logik\Witze_Web\Views\Home\Index.cshtml    Line: 20 

Stack Trace: 





[Win32Exception (0x80004005): The system cannot find the file specified]

[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5295887
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +242

如果您需要任何其他信息,請詢問。

看一下stacktrace,你有以下錯誤:

服務器未找到或無法訪問。 驗證實例名稱是否正確,以及SQL Server是否配置為允許遠程連接。 (提供程序:SQL網絡接口,錯誤:52 - 無法找到本地數據庫運行時安裝。驗證是否已正確安裝SQL Server Express並且已啟用本地數據庫運行時功能。

最有可能的是,您的連接字符串無效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM