0

IIS にデプロイされた MVC ASP.NET Web ページをデバッグする際に、ひどい問題が発生しています。Web サイトは、作成された PC の localhost で完全に動作します。ただし、同じネットワーク上の別の PC でページに移動すると、次のエラーが発生します。

http://i.stack.imgur.com/N359Q.png

Fiddler2 をさらに調べると、次の情報が得られます。このソリューションから得られると思われる唯一のデバッグ情報です。

Fiddler2 情報

Layout.cshtml は次のとおりです。

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title - Intranet Page</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/Scripts/application.js" type="text/javascript" charset="utf-8"></script>
    </head>
    <body>
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title">@Html.ActionLink("IntranetPage", "Index", "Home")</p>
                </div>
                <div class="float-right">
                 <!--   <section id="login">
                    </div>
                    <div id="logindisplay">
                        Context.User.Identity.Name <strong>@Context.User.Identity.Name</strong>!
                    </section>  This works correctly to get DOMAIN/USERNAME-->
                </div>
            </div>
        </header>
        <div id="body">
            @RenderSection("featured", required: false)
            <section class="content-wrapper main-content clear-fix">
                @RenderBody()
            </section>
        </div>
        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </body>
</html>

そして、問題のインデックスページ:

@model IEnumerable<WhoIs.Models.Employee>
@{
    ViewBag.Title = "Contoso Employees";
}
@section featured {
    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                <h1>@ViewBag.Title.</h1>
            </hgroup>
        </div>
    </section>
}

      <label for="filter">Enter employee details here : </label>
      <input type="text" name="filter" value="" id="filter" />

<h2><strong>Users</strong> (<a href="/home/create" style="color: blue;">create new</a>)</h2>
<br />

<div style="min-height: 150px; font-size: 1.25em">
    <div style="margin-bottom: .5em">
        <table><thead><tr><th>Name</th><th>Branch</th><th>Phone No.</th><th>Username</th><th>Email</th></tr></thead>
            <tbody>
            @foreach ( var prod in Model )
                {
                    <tr>
                        <td>@prod.FullName</td> 
                        <td>@prod.Branch</td> 
                        <td>@prod.PhoneNo</td> 
                        <td>@prod.DomainAC</td> 
                        <td>@prod.Email</td> 
                        @if (User.IsInRole(@"Admins") || User.Identity.Name == prod.DomainAC) {
                                <td><a href="/home/edit/@prod.Id"  style="color: blue;">edit</a></td>
                         }else{
                         <td>User => @User.ToString()</td>   
                        }
                    </tr>
                 }
                 </tbody>
            </table>
        </div>
     </div>

これらは、Contoso の従業員のリストを含む単純なページをレンダリングし、管理者とユーザー自身が詳細を編集できるようにします。ここで私の問題を引き起こしている可能性のあるものを誰でも見ることができますか? 私はこれを徹底的に調査しましたが、結果はありませんでした。

リモート データベース Employees にリンクされているモデル フォルダーに .edmx ファイルを追加しました。web.config を編集して、次の行を追加することで、問題の可能性に関する詳細情報を提供しようとしました。

しかし、まだ上記のエラーメッセージしか表示されません。

この問題の原因を教えてください。データベースから取得するセクションをコメントアウトすると、エラーは解消されますが、解決できません。

どうもありがとう。

編集 :

Web.config 抽出:

<system.web>
    <compilation debug="true"/>
    <deployment retail="false" />
    <customErrors mode="Off">
    </customErrors>
    <httpHandlers>
      <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
    </httpHandlers>

    <pages
        validateRequest="false"
        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxx"
        pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxx"
        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx">
      <controls>
        <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxx" namespace="System.Web.Mvc" tagPrefix="mvc" />
      </controls>
    </pages>
  </system.web>
4

1 に答える 1

0

私も同様の問題を抱えていましたが、私が遭遇した多くの落とし穴があります。それらの完全なリストを提供して、それらを確認できるようにします。

  • IIS でディレクトリの参照を許可する
  • Web サイトが物理的に保存されているフォルダーで、IUSR と IIS_IUSR に読み取りと参照のアクセス許可があるかどうかを確認します。
  • ファイアウォールでポートへのアクセスを許可しているかどうかを確認してください
  • IP アドレスが正しいかどうかを確認します。外部 IP が内部 IP にリダイレクトされない可能性があります。または、(初歩的な間違いを犯しました) 外部ではなく内部 IP を参照しようとしているのかもしれません。

これが役立つことを願っています。ご不明な点がございましたら、お気軽にお問い合わせください。

于 2013-07-22T11:10:12.930 に答える