0

我在 ASP.NET MVC 应用程序中的动作下载有问题,在开发机器中它可以正常工作,但是当我将应用程序发布到 IIS 或从测试服务器进行测试时,我没有任何错误,没有例外,我只有在页面底部的白色窗口'witing for localhost ...'

我的控制器动作

public ActionResult DownloadDocument(int idDocument)
    {
        try
        {
            DocumentVM Document = ServiceApplicatif.getDocumentById(idDocument);
            //Get document from virtual path
            string FileName = ServiceFileUtilities.GetFileById(Document.StreamId);

            DownloadResult drs = new DownloadResult //it's a file and it works
            {
                RootPath = rootDocuments, //rootDocuments is a path to filetable
                ContentLength = Document.Length,
                ContentType = Document.MimeType,
                FileDownloadName = FileName,
                FileName = FileName
            };

            return drs;
        }
        catch (Exception ex)
        {
            throw new Exception("Erreur : " + ex.message.toString());
        }
    }

我的观点很简单

<button onclick="myFunction()">Click me</button>

还有我的 JQuery 函数

 function myFunction() {
        var pageURL = url; //url with idDocument which is right
        OpenPopupCenter(url, 'myWin', 600, 800);
    }

    function OpenPopupCenter(pageURL, title, w, h) {
        var left = (screen.width - w) / 2;
        var top = (screen.height - h) / 4;  // for 25% - devide by 4  |  for 33% - devide by 3
        var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no,adressbar=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
        targetWin.document.title = "Document";
    }
4

1 回答 1

0

问题是由应用程序池身份引发的,您应该在机器服务器上分配一个具有授权的用户

于 2015-05-06T13:37:05.120 回答