locked
Publish MVC 5 Application in Internet information Services RRS feed

  • Question

  • User-1684154527 posted

    Hi,

       I had a project which is based on asp.net MVC 5.I had publish my application in IIS.When I browse my application on IIS.Index Page is Displayed without errors.And also other pages without razor view works with no problems. But When I am clicking one my link which is in footer area shows error.And that page contains razor view controls. My Source code of page is given below. Also application uses Sql Server. When i am checking browser and browser console window it shows the error as follows

    Error in Browser -> Error An Error occurred while processing your request

    Error in Browser Console Window

    Failed to load resource: the server responded with a status of 500(Internal Server Error).

    Master Layout Page Code(Page Name->_HomeLayout.cshtml)

    <!DOCTYPE html>
    <html lang="en">

    <head>
    <meta charset="UTF-8">
    <meta name="description" content="">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <!-- Title -->
    <title>@ViewBag.Title</title>


    <!-- Favicon -->
    <link rel="icon" href="~/Content/cssmain/img/core-img/favicon.ico">
    <!-- Core Stylesheet -->

    @Styles.Render("~/Content/cmain/mst/styles")
    @Styles.Render("~/Content/cmain/cother/bstyles")

    </head>

    <body>
    <!-- Preloader -->
    <div class="preloader d-flex align-items-center justify-content-center">
    <div class="spinner"></div>
    </div>

    <!-- ##### Header Area Start ##### -->
    <header class="header-area">
    <!-- Top Header Area -->
    <div class="top-header-area">
    <div class="container">
    <div class="row">
    <div class="col-12">
    <div class="top-header-content d-flex align-items-center justify-content-between">
    <!-- Top Header Content -->
    <div class="top-header-meta">
    <p><b>Welcome to <span>Krishi Bhavan Kanhangad</span></b></p>
    </div>
    <!-- Top Header Content -->
    <div class="top-header-meta text-right">
    <a href="#" data-toggle="tooltip" data-placement="bottom" title="kbkhdagri@gmail.com"><i class="fa fa-envelope-o" aria-hidden="true"></i> <span>Email: kbkhdagri@gmail.com</span></a>
    <a href="#" data-toggle="tooltip" data-placement="bottom" title="0467-2202877"><i class="fa fa-phone" aria-hidden="true"></i> <span>Call Us: 0467-2202877</span></a>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>

    @if (@ViewBag.Title != "DataBank Enquiry")
    {
    <div style="width: 100%;background-color: white;text-align: center">
    <a href="@Url.Action("DataBankEnquiry", "Home")" style="color: red;font-weight: bold;font-size: 14px;" target="_blank">->Data Bank Enquiry</a>

    </div>
    }
    <!-- Navbar Area -->
    <div class="famie-main-menu">
    <div class="classy-nav-container breakpoint-off">
    <div class="container">
    <!-- Menu -->
    <nav class="classy-navbar justify-content-between" id="famieNav">
    <!-- Nav Brand -->
    <a href="@Url.Action("Index", "Home")" class="nav-brand"><img src="~/Content/cssmain/img/core-img/logo.png" alt=""></a>
    <!-- Navbar Toggler -->
    <div class="classy-navbar-toggler">
    <span class="navbarToggler"><span></span><span></span><span></span></span>
    </div>
    <!-- Menu -->
    <div class="classy-menu">
    <!-- Close Button -->
    <div class="classycloseIcon">
    <div class="cross-wrap"><span class="top"></span><span class="bottom"></span></div>
    </div>
    <!-- Navbar Start -->
    <div class="classynav">
    <ul>
    <li class="active"><a href="@Url.Action("Index", "Home")">Home</a></li>
    <li><a href="@Url.Action("About", "Home")">About</a></li>
    <!--<li><a href="#">Pages</a>
    <ul class="dropdown">
    <li><a href="index.html">Home</a></li>
    <li><a href="about.html">About Us</a></li>
    <li><a href="farming-practice.html">Farming Practice</a></li>
    <li><a href="shop.html">Shop</a>
    <ul class="dropdown">
    <li><a href="our-product.html">Our Products</a></li>
    <li><a href="shop.html">Shop</a></li>
    </ul>
    </li>
    <li><a href="news.html">News</a>
    <ul class="dropdown">
    <li><a href="news.html">News</a></li>
    <li><a href="news-details.html">News Details</a></li>
    </ul>
    </li>
    <li><a href="contact.html">Contact</a></li>
    </ul>
    </li>->
    <li><a href="our-product.html">Our Product</a></li>
    <li><a href="farming-practice.html">Farming Practice</a></li>
    <li><a href="news.html">News</a></li>
    <li><a href="contact.html">Contact</a></li>
    </ul>
    <!-- Search Icon -->
    <!--<div id="searchIcon">
    <i class="icon_search" aria-hidden="true"></i>
    </div>-->
    <!-- Cart Icon -->
    <!--<div id="cartIcon">
    <a href="#">
    <i class="icon_cart_alt" aria-hidden="true"></i>
    <span class="cart-quantity">2</span>
    </a>
    </div>-->

    <li><a href="@Url.Action("Services", "Home")">Services</a></li>

    <li><a href="@Url.Action("OurProjects", "Home")">Our Projects</a></li>
    <li><a href="@Url.Action("News", "Home")">News</a></li>
    <li><a href="@Url.Action("Contact", "Home")">Contact</a></li>
    </ul>

    </div>
    <!-- Navbar End -->
    </div>
    </nav>

    <!-- Search Form -->
    <!--<div class="search-form">
    <form action="#" method="get">
    <input type="search" name="search" id="search" placeholder="Type keywords &amp; press enter...">
    <button type="submit" class="d-none"></button>
    </form>-->
    <!-- Close Icon -->
    <!--<div class="closeIcon"><i class="fa fa-times" aria-hidden="true"></i></div>
    </div>-->
    </div>
    </div>
    </div>
    </header>
    <!-- ##### Header Area End ##### -->
    <!-- ##### Breadcrumb Area Start ##### -->
    <div class="breadcrumb-area bg-img bg-overlay jarallax" style="background-image: url('@Url.Content("~/Content/cssmain/img/bg-img/1.jpg")')">
    <div class="container h-100">
    <div class="row h-100 align-items-center">
    <div class="col-12">
    <div class="breadcrumb-text">
    <h2>@ViewBag.Title</h2>
    </div>
    </div>
    </div>
    </div>
    </div>
    <div class="famie-breadcrumb" style="padding-bottom: 18px;">
    <div class="container">
    <nav aria-label="breadcrumb">
    <ol class="breadcrumb">
    <li class="breadcrumb-item"><a href="@Url.Action("Index", "Home")"><i class="fa fa-home"></i> Home</a></li>
    <li class="breadcrumb-item active" aria-current="page">@ViewBag.Title</li>
    </ol>
    </nav>
    </div>
    </div>

    <section class="about-us-area">

    @RenderBody()

    </section>

    <!-- ##### Footer Area Start ##### -->
    <footer class="footer-area">
    <!-- Main Footer Area -->
    <div class="main-footer bg-img bg-overlay section-padding-80-0" style="background-image: url('@Url.Content("~/Content/cssmain/img/bg-img/3.jpg")')">
    <div class="container">
    <div class="row">

    <!-- Single Footer Widget Area -->
    <div class="col-12 col-sm-6 col-lg-3">
    <div class="footer-widget mb-80">
    <h5 class="widget-title">CONTACT</h5>
    <!-- <a href="#" class="foo-logo d-block mb-30"><img src="img/core-img/logo2.png" alt=""></a>
    <!-- <p>Lorem ipsum dolor sit amet, consecte stare adipiscing elit. In act honcus risus atiner Pellentesque risus.</p>-->
    <p>
    <b>Krishi Bhavan Kanhangad</b>
    <br />
    (Kanhangad Muncipality)
    </p>
    <div class="contact-info">
    <p><i class="fa fa-map-pin" aria-hidden="true"></i><span>Lakshmi Nagar,Alamipally</span></p>
    <p><i class="#" aria-hidden="true"></i><span>Kanhangad-Kasaragod - 671315</span></p>
    <p><i class="fa fa-envelope" aria-hidden="true"></i><span>kbkhdagri@gmail.com</span></p>
    <p><i class="fa fa-phone" aria-hidden="true"></i><span>0467-2202877</span></p>
    </div>
    </div>
    </div>

    <!-- Single Footer Widget Area -->
    <div class="col-12 col-sm-6 col-lg-3">
    <div class="footer-widget mb-80">
    <h5 class="widget-title">QUICK LINK</h5>
    <!-- Footer Widget Nav -->
    <nav class="footer-widget-nav">
    <ul>
    <li><a href="@Url.Action("DataBankEnquiry", "Home")" target="_blank">Data Bank Enquiry</a></li>
    <li></li>
    <li><a href="complaintstatus.html" target="_blank">Complaint Status</a></li>

    </ul>
    </nav>
    </div>
    </div>

    <!-- Single Footer Widget Area -->
    <div class="col-12 col-sm-6 col-lg-3">
    <div class="footer-widget mb-80">
    <h5 class="widget-title">RECENT NEWS</h5>

    <!-- Single Recent News Start -->
    <div class="single-recent-blog d-flex align-items-center">
    <div class="post-thumbnail">
    <img src="~/Content/cssmain/img/bg-img/4.jpg" alt="">
    </div>
    <div class="post-content">
    <a href="#" class="post-title">Latest News First</a>
    <div class="post-date">18 Aug 2018</div>
    </div>
    </div>

    <!-- Single Recent News Start -->
    <div class="single-recent-blog d-flex align-items-center">
    <div class="post-thumbnail">
    <img src="~/Content/cssmain/img/bg-img/5.jpg" alt="">
    </div>
    <div class="post-content">
    <a href="#" class="post-title">Latest News Second</a>
    <div class="post-date">18 Aug 2018</div>
    </div>
    </div>

    </div>
    </div>

    <!-- Single Footer Widget Area -->
    <div class="col-12 col-sm-6 col-lg-3">
    <div class="footer-widget mb-80">
    <h5 class="widget-title">STAY CONNECTED</h5>
    <!-- Footer Social Info -->
    <div class="footer-social-info">
    <a href="#">
    <i class="fa fa-facebook" aria-hidden="true"></i>
    <span>Facebook</span>
    </a>
    <a href="#">
    <i class="fa fa-twitter" aria-hidden="true"></i>
    <span>Twitter</span>
    </a>
    <a href="#">
    <i class="fa fa-pinterest" aria-hidden="true"></i>
    <span>Pinterest</span>
    </a>
    </div>
    </div>
    </div>

    </div>
    </div>
    </div>

    <!-- Copywrite Area -->
    <div class="copywrite-area">
    <div class="container">
    <div class="copywrite-text text-center">
    <div class="row align-items-center">
    <div class="col-md-12">
    <p>
    <!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
    Copyright &copy;
    <script>document.write(new Date().getFullYear());</script> All rights reserved | Designed <!--<i class="fa fa-heart-o" aria-hidden="true"></i>--> by <a href="#" target="_blank">Karma Agro Informatics Karshika Karmasena Krishi Bhavan Kanhangad</a>
    <!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
    </p>
    </div>

    </div>
    </div>
    </div>
    </div>
    </footer>
    <!-- ##### Footer Area End ##### -->
    <!-- ##### All Javascript Files ##### -->

    @Scripts.Render("~/bundles/jqmain")

    @RenderSection("scripts", required: false)

    </body>

    </html>

     2. Child Page(Name->DataPage.cshtml) ->Error While loading this page

    @model KRDataBank.Models.DataBankEnquiryModel
    @{
    ViewBag.Title = "DataBank Enquiry";

    }

    @section scripts {

    <script >

    $(document).ready(function () {


    var divloc = $("#divbtn").offset();

    $('html,body').animate({ scrollTop: divloc.top }, "slow");

    });

    </script>
    }

    <div class="container" >
    <div class="row justify-content-between">


    <!-- Contact Content -->
    <div class="col-12 col-lg-7">
    <div class="contact-content mb-100">
    <!-- Section Heading -->

    <div class="section-heading" style="margin-bottom: 2px;">
    <p>@ViewBag.Title</p>
    <!-- <h2><span>Let Us</span> Tell You Our Story</h2>-->
    <img src="~/Content/cssmain/img/core-img/decor.png" alt="">
    </div>

    <!-- Contact Form Area -->
    <div class="contact-form-area">

    @using (Html.BeginForm())
    {
    @Html.AntiForgeryToken()


    <div class="container">

    @Html.ValidationSummary(true, "", new { @class = "text-danger" })

    <div class="form-group row py-sm-3 mb-0">
    @Html.LabelFor(model => model.Village, htmlAttributes: new { @class = "col-sm-2 col-form-label", @style = "font-size:13px" })
    <div class="col-sm-5 col-md-4 mb-3">
    @*@Html.EditorFor(model => model.Village, new { htmlAttributes = new { @class = "form-control" } })*@
    @Html.DropDownListFor(model => model.Village, new SelectList(new[] { "", "Kanhangad", "Hosdurg", "Balla", "Pudukkai" }), new { @class = "custom-select", @style = "font-size:13px" })
    </div>
    <div class="col-sm-5 col-md-3 mb-3">


    @Html.ValidationMessageFor(model => model.Village, "", new { @class = "text-danger", @style = "font-size:13px" })


    </div>
    </div>

    <div class="form-group row py-sm-12 mb-0">
    @Html.LabelFor(model => model.SurveyNo, htmlAttributes: new { @class = "col-sm-2 col-form-label", @style = "font-size:13px" })
    <div class="col-sm-4">
    @Html.EditorFor(model => model.SurveyNo, new { htmlAttributes = new { @class = "form-control", @placeholder = "Ex:-121/5" } })
    </div>
    <div class="col-sm-4">
    @Html.ValidationMessageFor(model => model.SurveyNo, "", new { @class = "text-danger", @style = "font-size:13px" })
    </div>
    </div>

    <div class="form-group row py-sm-12 mb-0">
    @Html.LabelFor(model => model.Part, htmlAttributes: new { @class = "col-sm-2 col-form-label", @style = "font-size:13px" })
    <div class="col-sm-4">
    @Html.EditorFor(model => model.Part, new { htmlAttributes = new { @class = "form-control" } })
    @*@Html.ValidationMessageFor(model => model.PartNo, "", new { @class = "text-danger" })*@
    </div>
    </div>

    <div class="form-group row py-sm-12 mb-0">
    @Html.LabelFor(model => model.MobileNo, htmlAttributes: new { @class = "col-sm-2 col-form-label", @style = "font-size:13px" })
    <div class="col-sm-4">
    @Html.EditorFor(model => model.MobileNo, new { htmlAttributes = new { @class = "form-control" } })
    </div>
    <div class="col-sm-4">
    @Html.ValidationMessageFor(model => model.MobileNo, "", new { @class = "text-danger", @style = "font-size:13px" })
    </div>
    </div>

    <div class="form-group row pb-3" id="divbtn">
    @Html.LabelFor(model => model.AadhaarNo, htmlAttributes: new { @class = "col-sm-2 col-form-label", @style = "font-size:13px" })
    <div class="col-sm-5">
    @Html.EditorFor(model => model.AadhaarNo, new { htmlAttributes = new { @class = "form-control" } })
    </div>

    <div class="col-sm-4">
    @Html.ValidationMessageFor(model => model.AadhaarNo, "", new { @class = "text-danger", @style = "font-size:13px" })
    </div>

    <div class="offset-sm-1 offset-md-2 col-sm-4" >
    <input name="commit" value="Search" class="btn famie-btn" id="btnsearch" onclick="window.scrollTo(0, document.body.scrollHeight);" type="submit">
    </div>

    </div>


    @if (@ViewBag.isShown == true)
    {

    if (@ViewBag.SearchStatus == "0")
    {
    <div class="form-group row pb-3">
    <div class="offset-sm-2 offset-md-2 col-sm-4" style="font-size: 14px;font-weight: bold;color: red">

    @ViewBag.SearchResult


    </div>

    </div>

    }
    else
    {
    <div class="form-group row pb-3">

    @Html.LabelFor(model => model.DryOrWet, htmlAttributes: new { @class = "col-sm-2 col-form-label", @style = "font-size:13px;visibility:hidden" })
    <div class="col-sm-4" style="font-size: 14px;font-weight: bold;color: green">

    @ViewBag.SearchResult

    </div>

    </div>

    <div class="form-group row">
    <div class="offset-sm-2 offset-md-2 col-sm-4">
    <a href="@Url.Action("Complaint", "Home")" class="btn famie-btn" target="_blank">Complaint Register</a>
    @*<input type="submit" name="commit" value="Complaint Register" class="btn famie-btn" />*@
    </div>
    </div>
    }
    }


    </div>
    }

    </div>
    </div>
    </div>
    </div>
    </div>

    3.Web Config File

    <?xml version="1.0"?>
    <!--
    For more information on how to configure your ASP.NET application, please visit
    https://go.microsoft.com/fwlink/?LinkId=301880
    -->
    <configuration>
    <appSettings>
    <add key="webpages:Version" value="3.0.0.0"/>
    <add key="webpages:Enabled" value="false"/>
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
    </appSettings>
    <connectionStrings>
    <add name="conn" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=KRDataBank;User Id=sa;Password=eqz" providerName="System.Data.SqlClient"/>
    <add name="Excel03Con" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR=YES'"/>
    <add name="Excel07Con" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;HDR=YES'"/>
    </connectionStrings>

    <system.web>

    <compilation debug="true" targetFramework="4.7.2"/>
    <httpRuntime targetFramework="4.7.2"/>
    <sessionState timeout="30"/>
    <!--<authentication mode ="Forms">
    <forms loginUrl="~/Admin/Index" slidingExpiration="true" timeout="2880"></forms>
    </authentication>-->
    <customErrors mode="On">
    <error statusCode="404" redirect="~/Error/NotFound"/>
    </customErrors>
    </system.web>
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true">

    <!--<remove name="BundleModule"/>
    <add name="BundleModule" type="System.Web.Optimization.BundleModule"/>-->

    </modules>
    </system.webServer>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f"/>
    <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed"/>
    <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0"/>
    </dependentAssembly>
    </assemblyBinding>
    </runtime>
    <system.codedom>
    <compilers>
    <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
    <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
    </system.codedom>
    </configuration>

    Friday, August 16, 2019 12:01 PM

Answers

  • User1520731567 posted

    Hi Muraleedharan,

    Where you call DataPage.cshtml in Layout?

    What is the action of DataPage.cshtml?

    I suggest you could double click the error in F12 console to check the specific detailed error message.

    Best Regards.

    Yuki Tao

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 19, 2019 9:34 AM
  • User-1684154527 posted

    My issue solved sir.I had checked your suggestion.Its some coding issue.Thank you sir

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 20, 2019 10:49 AM

All replies

  • User1520731567 posted

    Hi Muraleedharan,

    Where you call DataPage.cshtml in Layout?

    What is the action of DataPage.cshtml?

    I suggest you could double click the error in F12 console to check the specific detailed error message.

    Best Regards.

    Yuki Tao

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 19, 2019 9:34 AM
  • User-1684154527 posted

    My issue solved sir.I had checked your suggestion.Its some coding issue.Thank you sir

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 20, 2019 10:49 AM