- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
re jQuery.noConflict(); ' type=-6ren">
以下是我在两个不同页面上使用的客户端代码:
<script src='<%= Page.ResolveUrl("~/resources/js/jquery-1.6.4.min.js") %>' type="text/javascript"></script>re
<script type="text/javascript">
jQuery.noConflict();
</script>
<script src='<%= Page.ResolveUrl("~/resources/js/jquery.signalR-1.2.0.min.js") %>' type="text/javascript"></script>
<script src='<%= Page.ResolveUrl("~/signalr/hubs") %>' type="text/javascript"></script>
<script type="text/javascript">
jQuery(function () {
// Declare a proxy to reference the hub.
var usr = jQuery.connection.notificationHub;
jQuery.connection.hub.logging = true;
jQuery.connection.hub.qs = "clientId=arif";// +readCookie("personId");
jQuery.connection.hub.start().done(function () {
});
usr.client.showUsersOnLine = function (data) {
};
});
</script>
在一个页面上它已连接并且工作正常,但在另一页面上它给了我以下错误:
[ArgumentException: Could not cast or convert from System.String to System.Collections.Generic.IEnumerable`1[Microsoft.AspNet.SignalR.Hubs.HubDispatcher+ClientHubInfo].]
Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType) +241
Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType) +123
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType) +238
[JsonSerializationException: Error converting value "[{"name": "notificationhub"}]" to type 'System.Collections.Generic.IEnumerable`1[Microsoft.AspNet.SignalR.Hubs.HubDispatcher+ClientHubInfo]'. Path '', line 1, position 35.]
Microsoft.Owin.Host.SystemWeb.Infrastructure.<>c__DisplayClass1.<GetRethrowWithNoStackLossDelegate>b__0(Exception ex) +27
Microsoft.Owin.Host.SystemWeb.Infrastructure.ErrorState.Rethrow() +34
Microsoft.Owin.Host.SystemWeb.CallContextAsyncResult.End(IAsyncResult result) +49
Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.EndProcessRequest(IAsyncResult result) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9628972
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
我看到的唯一区别是:调用协商 utl 时,“connectionData”参数不同:对于其工作的页面如下:
connectionData [{"name":"notificationhub"}]
对于无法正常工作的页面,如下所示:
connectionData "[{\"name\": \"notificationhub\"}]"
任何人都可以建议我实际上缺少什么或应该检查什么吗?
最佳答案
好的,这就是我收到此错误的原因。
在jquery.signalr-2.0.0.js
文件中,在第2578行设置断点
connection.data = connection.json.stringify(subscribedHubs);
进入该函数调用并查看您的 JSON.stringify
方法是否已被覆盖。就我而言,我使用的是旧版本的 prototype.js,它覆盖了 JSON.stringify 函数,导致发生错误的解析。
此外,尝试从 F12 开发人员工具运行以下命令:
JSON.stringify([{name:"testhub"}]);
如果应该返回"[{"name":"testhub"}]"
,如果返回""[{\"name\":\"testhub\"}] ""
您的 stringify 已被泄露。
关于jquery - SignalR : Could not cast or convert from System. 字符串到 System.Collections.Generic.IEnumerable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21819872/
我很确定我不会是第一个被这个绊倒的人,但我找不到答案。这是作业。 class Tier{} class Fisch extends Tier{} class Vogel extends Tier{}
在接收器开发人员指南中如下: Applications running on the Google Cast receiver device (receiver applications) are a
最近我制作了一个自定义本地 Flask 网站,用于从本地设备转换到连接到我的电视的 RPi4。有一个 GUI它也可以通过 GET 请求控制,这是转换工作的主要方式,实际上是通过 GET 请求将数据从
最近我因为某些原因重置了我的路由器,所以当我尝试将它连接到 chromecast 时,Chromecast 没有在其列表中列出我的 wifi 名称。 之前它工作正常,所以我选择其他并手动输入我的网络名
做这样的 Actor 阵容的好方法是什么? seq { yield (box "key", box "val") } |> Seq.cast 因为这看起来非常难看: seq { yield (box
我继承的遗留 Web 应用程序是在经典 ASP 中为新西兰乐施会定制编写的,它在用户提交的输入上运行字符串替换,删除字符串“cast”,大概是因为 cast 函数。 然而,这意味着我们的参与者都不能拥
我去了三星网站并下载了 Media Control SDK 包。当我在我的 Galaxy S3 Android 4.3 上使用 AllShare Cast 视频播放器时,我的智能电视(在同一网络中)出
如何在 BigQuery 中查看 INT64 的二进制表示形式?将其转换为 BYTES 类型也可以。 最佳答案 正如@Elliot Brossard 所述,INT64 如何执行是一个实现问题。类型表示
Google 的文档要求我们设置自己的网络服务器来托管 receiver.html。 是否有任何人都可以使用的默认公共(public) chrome-cast 接收器? 我只需要非常基本的接收器,与
我在 Eclipse 3.6 (Helios) 中运行某人的代码时遇到问题。代码是用 OpenJDK 7 编写的。我运行的是 Windows 7,我必须为它安装 Java 7。我之前使用的是 Java
所以我有一些 COM 类型,它们的名称很难记住、又长又笨重,所以如果可以避免的话,我宁愿在从对象进行转换时不必键入它们。使用 Seq.cast 它将推断所需的类型并根据需要进行强制转换。 这是一个用
假设您不关心编译器和机器的转换风格,以下之间是否存在明显差异: #include #include #include static int64_t tosigned (void *p) {
我的测试类 XString 有两个转换运算符。但是编译器不会为 fooA 使用显式转换 operator const wchar_t*()。为什么? class XString { public:
我有以下代码: T imageCollectionItem; // This checks if image actually exists, if it doesn't it gets the ne
这有点假设,因为我不太担心性能 - 只是想知道一般来说哪个选项实际上最快/最有效,或者是否没有任何区别。 假设我有以下支持重载的访问者模板代码: #define IMPLEMENT_VISITOR_W
我目前正在存储复选框的真/假状态。在注册表中检查值以在下次加载表单时重置。 加载表单时,我获取值并像这样设置复选框。 string value = (string)Registry.GetValue(
enum Gender { Male, Female } var k = new[] { Gender.Male }.Cast().ToList().Cast().ToList(); //alrigh
我正在按照 https://codelabs.developers.google.com/codelabs/cast-receiver#0 上的教程构建一个 chrome cast 自定义接收器。我无
我看不懂以下作品 SELECT price, CAST(price AS DECIMAL(10,2)) FROM orders; 但是更新失败: UPDATE orders SET price = C
在 Cast v3 中,如何手动更改“停止转换”按钮的颜色? 我可以为其他所有内容更改转换对话框或媒体路由器的样式,但“停止转换”按钮似乎会根据背景颜色切换为黑色/蓝色。 我的主题:
我是一名优秀的程序员,十分优秀!