我尝试在MVC应用程序中使用SignalR.它工作正常,但我在Chrome控制台中收到以下错误
WebSocket connection to 'ws://localhost:18245/signalr/connect?transport=webSockets&clientProtocol=1.4&connectionToken=bNDGLnbSQThqY%2FSjo1bt
8%2FL45Xs22BDs2VcY8O7HIkJdDaUJ4ftIc54av%2BELjr27ekHUiTYWgFMfG6o7RaZwhf
fpXavzWQ1jvkaxGm5rI%2BWtK7j0g1eQC2aOYP366WmRQLXCiYJfsm4EbwX6T8n2Aw
%3D%3D&connectionData=%5B%7B%22name%22%3A%22importerhub%
22%7D%5D&tid=9' failed: HTTP Authentication failed; no valid credentials available
Run Code Online (Sandbox Code Playgroud)
有趣的是,我通过Hub从Controller调用的jquery方法运行正常.
jQuery的:
$(function () {
// Initialize the connection to the server
var importerHub = $.connection.importerHub;
// Preparing a client side function
// called sendMessage that will be called from the server side
importerHub.client.sendMessage = function (message) {
showOrUpdateSuccessMessage(message);
};
$.connection.hub.start();
});
Run Code Online (Sandbox Code Playgroud)
控制器:
var hubContext = GlobalHost.ConnectionManager.GetHubContext<ImporterHub>();
hubContext.Clients.All.sendMessage("All operations complete");
Run Code Online (Sandbox Code Playgroud)
我使用.Net v4.5.1,SignalR v2.1.2.0和IIS 8.5与Windows身份验证.
我该如何解决这个错误?
我喜欢子类化NSProgressIndicator.我已经使用了这段代码,并在Interface Builder中设置了Subclass:
- (void)drawRect:(NSRect)dirtyRect {
NSRect rect = NSInsetRect([self bounds], 1.0, 1.0);
CGFloat radius = rect.size.height / 2;
NSBezierPath *bz = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:radius yRadius:radius];
[bz setLineWidth:2.0];
[[NSColor blackColor] set];
[bz stroke];
rect = NSInsetRect(rect, 2.0, 2.0);
radius = rect.size.height / 2;
bz = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:radius yRadius:radius];
[bz setLineWidth:1.0];
[bz addClip];
rect.size.width = floor(rect.size.width * ([self doubleValue] / [self maxValue]));
NSRectFill(rect);
Run Code Online (Sandbox Code Playgroud)
当应用程序启动时,它看起来像这样:

但在复制过程中,旧栏出现了.

怎么了?