我在ASP.NET MVC应用程序中有动作下载的问题,在dev机器上它没有任何问题,但是当我将应用程序发布到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";
}
答案 0 :(得分:0)
应用程序池标识抛出了问题,您应该在计算机服务器上为用户分配了授权