我在Windows Azure上部署了一个asp.net mvc 4应用程序,当我在localhost中测试该应用程序时一切正常,但是在azure网站上,有一个视图返回错误500,我不知道为什么会发生,您可以在这里帮助我吗?

这是视图:

@model IEnumerable<TestTcc2.Models.Musica>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutMusico.cshtml";
}

<script src="Content/audiojs/audio.min.js"></script>
<div class="row">
<div class="col-md-4"></div>
<div id="divAudio" class="col-md-4">

    <audio id="audioPlay" src="x" preload="auto" onplay="true" />
    <script>
        audiojs.events.ready(function () {
            var as = audiojs.createAll({
                autoplay: true,
                autoload: "none"
            });

        });

        function replaceAll(str, de, para) {
            var pos = str.indexOf(de);
            while (pos > -1) {
                str = str.replace(de, para);
                pos = str.indexOf(de);
            }
            return (str);
        }

        function getUrlParameter(sParam) {
            var sPageURL = window.location.search.substring(1);
            var sURLVariables = sPageURL.split('&');
            for (var i = 0; i < sURLVariables.length; i++) {
                var sParameterName = sURLVariables[i].split('=');
                if (sParameterName[0] == sParam) {
                    var rep = replaceAll(sParameterName[1], "%2F", "/");
                    rep = replaceAll(rep, "%20", " ");
                    return rep;
                }
            }
        }
        var x = getUrlParameter('path');
        $('#audioPlay').attr('src', x);
    </script>
</div>
<div class="col-md-4"></div>
</div>
<br />
<p>
    @Html.ActionLink("Create New", "Create")
</p>

<table class="table table-hover table-bordered">
    <tr>
        <th>
            <span>Genero</span>
        </th>

        <th>
            <span>Nome</span>
        </th>
        <th>
            <span>Artista</span>
        </th>
        <th>
            <span>Preço</span>
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    if (item.UserId == Int32.Parse(Membership.GetUser().ProviderUserKey.ToString()))
    {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.genero.Nome)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Nome)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.NomeArtista)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Preco)
        </td>
        <td>
            @Html.ActionLink("Play", "", new { path = item.path }) |
            @Html.ActionLink("Edit", "Edit", new { id=item.MusicaId }) |
            @Html.ActionLink("Download", "Download", new { path = item.path }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.MusicaId })
        </td>
    </tr>
}
}

</table>


这是调用视图的控制器方法:

public ActionResult Index()
{
        var musicas = db.Musicas.Include(m => m.genero);
        var _arquivos = modelMusica.listaMusica();
        return View(musicas.ToList());
}


我试图进行调试,但是任何错误都会显示在localhost中,并且在蔚蓝中会显示以下消息:


  错误。处理您的请求时发生错误。


在我的web.config中,我还将CustomErrors设置为off,并将debug设置为false。

更新----

大家好,我从Azure取得了DetailedError:

Detailed Error Information:
Module    ManagedPipelineHandler
Notification    ExecuteRequestHandler
Handler    System.Web.Mvc.MvcHandler
Error Code    0x00000000
Requested URL    http://independentmusicstore:80/Music
Physical Path    D:\home\site\wwwroot\Music
Logon Method    Forms
Logon User    pedro

最佳答案

您在eventlog.xml中看到错误吗?使用http://blogs.msdn.com/b/waws/archive/2014/09/24/azure-website-siteextension-to-view-eventlogs.aspx中提到的步骤检查事件日志,或直接转到yourazuresitename.scm.azurewebsites.net/support,然后选择您的站点并选择->分析,然后单击“事件查看器” ...

应将未处理的异常作为HTTP 500冒泡,应将其记录在事件查看器中。如果您在事件日志中没有看到任何条目,请通过转到站点->在azure门户中配置来启用详细错误,并在d:\ home \ logfiles文件夹下查找详细错误文件夹(您可以通过kudu或ftp访问此文件夹)

10-08 09:04
查看更多