无法发布 ASP.NET SignalR 代码
Unable to publish an ASP.NET SignalR code
我在 classic ASP.NET Web 窗体中实现了 SignalR 以启用进度条。在本地测试实施时一切正常
但是,当我尝试将代码发布到服务器时,应用程序崩溃并显示一个非常普通的 ASP.NET 错误
发布 SignalR 时,我必须使用或执行哪些特定操作?
非常感谢您
这是我的中心 class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
namespace IAACCESS.SignalR
{
public class ProgressHub : Hub
{
static ProgressHub()
{
}
}
}
这是我的创业公司class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(IAACCESS.SignalR.Startup1))]
namespace IAACCESS.SignalR
{
public class Startup1
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
}
这是我的JavaScript部分
function ProgressBarModal(showHide) {
if (showHide === 'show') {
$('#mod-progress').show();
if (arguments.length >= 2) {
$('#progressBarParagraph').text(arguments[1]);
} else {
$('#progressBarParagraph').text(arguments[1]);
}
window.progressBarActive = true;
} else {
$('#mod-progress').hide();
window.progressBarActive = false;
}
}
$(function () {
// Reference the auto-generated proxy for the hub.
var progress = $.connection.progressHub;
console.log(progress);
// Create a function that the hub can call back to display messages.
progress.client.AddProgress = function (fileName, message, percentage) {
ProgressBarModal("show", fileName + " " + message);
document.getElementById("divProgress").style.display = "block";
document.getElementById("divUpload").style.display = "block";
document.getElementById("divProgress").style.width = percentage + "%";
document.getElementById("<%=lblPercentage.ClientID %>").firstChild.data = parseInt(percentage) + "%";
$('#ProgressMessage').width(percentage);
if (percentage === "100%") {
ProgressBarModal();
}
};
$.connection.hub.start().done(function () {
var connectionId = $.connection.hub.id;
console.log(connectionId);
});
});
首先,正如我在评论中提到的,我将自定义错误属性从 RemoteOnly 更改为 Off。
我看到了更好的错误描述
Server Error in '/access_int' Application. This operation requires IIS
integrated pipeline mode
我转到 IIS,将应用程序池设置从基本更改为集成
那又给了我一个错误
500 - Internal server error. There is a problem with the resource you
are looking for, and it cannot be displayed
然后我去IIS把identity impersonate的属性改成了false
之后一切正常
我在 classic ASP.NET Web 窗体中实现了 SignalR 以启用进度条。在本地测试实施时一切正常
但是,当我尝试将代码发布到服务器时,应用程序崩溃并显示一个非常普通的 ASP.NET 错误
发布 SignalR 时,我必须使用或执行哪些特定操作?
非常感谢您
这是我的中心 class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
namespace IAACCESS.SignalR
{
public class ProgressHub : Hub
{
static ProgressHub()
{
}
}
}
这是我的创业公司class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(IAACCESS.SignalR.Startup1))]
namespace IAACCESS.SignalR
{
public class Startup1
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
}
这是我的JavaScript部分
function ProgressBarModal(showHide) {
if (showHide === 'show') {
$('#mod-progress').show();
if (arguments.length >= 2) {
$('#progressBarParagraph').text(arguments[1]);
} else {
$('#progressBarParagraph').text(arguments[1]);
}
window.progressBarActive = true;
} else {
$('#mod-progress').hide();
window.progressBarActive = false;
}
}
$(function () {
// Reference the auto-generated proxy for the hub.
var progress = $.connection.progressHub;
console.log(progress);
// Create a function that the hub can call back to display messages.
progress.client.AddProgress = function (fileName, message, percentage) {
ProgressBarModal("show", fileName + " " + message);
document.getElementById("divProgress").style.display = "block";
document.getElementById("divUpload").style.display = "block";
document.getElementById("divProgress").style.width = percentage + "%";
document.getElementById("<%=lblPercentage.ClientID %>").firstChild.data = parseInt(percentage) + "%";
$('#ProgressMessage').width(percentage);
if (percentage === "100%") {
ProgressBarModal();
}
};
$.connection.hub.start().done(function () {
var connectionId = $.connection.hub.id;
console.log(connectionId);
});
});
首先,正如我在评论中提到的,我将自定义错误属性从 RemoteOnly 更改为 Off。
我看到了更好的错误描述
Server Error in '/access_int' Application. This operation requires IIS integrated pipeline mode
我转到 IIS,将应用程序池设置从基本更改为集成
那又给了我一个错误
500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed
然后我去IIS把identity impersonate的属性改成了false
之后一切正常