web-dev-qa-db-ja.com

[Win32Exception(0x80004005):システムは指定されたファイルを見つけることができません]

私はジョークWebアプリケーションに取り組んでいます。

私はC#、Entity Framework、MVCを使用しており、コードファーストで作業しています。

DB内の何かを読み込もうとすると、タイトルに入力したエラーが表示されます。そして、私は何を探すべきかわかりません。グーグルを調べたのですが、なかなか答えが出ませんでした...

私はあなたが知る必要があるかもしれないすべてのコードを提供しようとします:

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

その他の情報が必要な場合は、お問い合わせください。

6
WTFisOssi

スタックトレースを見てください。次のエラーがあります。

サーバーが見つからないか、アクセスできませんでした。インスタンス名が正しいこと、およびSQLServerがリモート接続を許可するように構成されていることを確認してください。 (プロバイダー:SQLネットワークインターフェイス、エラー:52-ローカルデータベースランタイムのインストールが見つかりません。SQLServerExpressが正しくインストールされていること、およびローカルデータベースランタイム機能が有効になっていることを確認してください。

おそらく、接続文字列が無効です。

6
ken2k