小编pol*_*kyg的帖子

SignalR无法读取未定义的属性客户端

我正在尝试将SignalR添加到我的项目中(ASPNET MVC 4).但我不能让它发挥作用.

在下图中,您可以看到我收到的错误. 图片 我已经阅读了很多stackoverflow帖子,但没有一个是解决我的问题.

这是我到目前为止所做的:

1) Ran Install-Package Microsoft.AspNet.SignalR -Pre
2) Added RouteTable.Routes.MapHubs(); in Global.asax.cs Application_Start()
3) If I go to http://localhost:9096/Gdp.IServer.Web/signalr/hubs I can see the file content
4) Added <modules runAllManagedModulesForAllRequests="true"/> to Web.Config
5) Created folder Hubs in the root of the MVC application
6) Moved jquery and signalR scripts to /Scripts/lib folder (I'm not using jquery 1.6.4, I'm using the latest)
Run Code Online (Sandbox Code Playgroud)

这是我的Index.cshtml

<h2>List of Messages</h2>

<div class="container">
    <input type="text" id="message" />
    <input type="button" id="sendmessage" value="Send" />
    <input …
Run Code Online (Sandbox Code Playgroud)

c# signalr signalr-hub signalr.client

48
推荐指数
5
解决办法
6万
查看次数

'System.Data.Entity.Internal.AppConfig'的类型初始值设定项引发了异常

我在MVC 4 aspnet网站上使用EF5.在本地,一切正常,但当我将其发布到IIS并尝试进入时,我得到错误

"'System.Data.Entity.Internal.AppConfig'的类型初始化程序引发了异常."

详细例外

为entityFramework创建配置节处理程序时出错:在应用程序配置中多次指定DbContext类型'GdpSoftware.Server.Data.GdpSoftwareDbContext,GdpSoftware.Server.Data'的配置.每个上下文只能配置一次.(E:\ App\web.config第104行)

我在StackOverflow中检查了之前的问题,我已经通过Nuget EntityFramework卸载并重新安装,并检查每个项目中对它的每个引用都是EF5.我还检查了每个项目中选定的框架是4.5.

任何想法,可能导致问题的原因是什么?谢谢!吉列尔莫.

web.config中

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

  <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
  <connectionStrings>
    <add name="GdpSoftwareConnectionString" connectionString="Persist Security Info=False;User ID=user;Password=password;Initial Catalog=databasename;Data Source=server" providerName="System.Data.SqlClient" />
    <add name="GdpSoftware.Server.Data.GdpSoftwareDbContext" connectionString="GdpSoftware.Server.Data.GdpSoftwareDbContext_ConnectionString" providerName="System.Data.SqlClient"/>
    <add name="GdpSoftware.Server.Ui.Web.Models.UsersContext" connectionString="GdpSoftware.Server.Ui.Web.Models.UsersContext_ConnectionString" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" /> …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc entity-framework asp.net-mvc-4 entity-framework-5

40
推荐指数
4
解决办法
12万
查看次数

使用ASPNET MVC 3和Razor在单独的javascript文件中@ Url.Content

我正在使用它

if (ret = 1)
    iconType = new google.maps.MarkerImage('@Url.Content("~/Content/images/image.png")');
else if (ret = 2)
    iconType = new google.maps.MarkerImage('@Url.Content("~/Content/images/image2.png")');
else if (ret = 3)
    iconType = new google.maps.MarkerImage('@Url.Content("~/Content/images/image3.png")');
Run Code Online (Sandbox Code Playgroud)

在一个视图(ASPNET MVC 3)中,现在我将代码移动到一个单独的javascript文件(我正在使用它,因为取决于我设置为control image.png,image2.png或image3的图像的可变值. PNG).

Razor没有在javascript文件中解析@ Url.Content,处理这个问题的最佳方法是什么?

提前致谢!吉列尔莫.

javascript asp.net-mvc google-maps-markers

25
推荐指数
2
解决办法
3万
查看次数

jquery datepicker不能动态创建html

我正在用内部控件动态创建几个div.其中两个控件应该是datepickers.但由于某种原因,它们没有显示(只显示输入文本)如果我创建静态html,它会起作用,但是当我使用动态html时则不行.

这是我用来生成HTML的代码(我可以看到div)

var ShowContainerDiv = document.createElement('DIV');

var btnShowDiv = document.createElement('DIV');
btnShowDiv.id = 'btnShowDiv ';
btnShowDiv.title = 'Change';
btnShowDiv.index = 120;

var lblShow = document.createElement('label')
lblShow.htmlFor = "btnShowDiv";
lblShow.appendChild(document.createTextNode('Show'));
btnShowDiv.appendChild(lblShow );
btnShowDiv.onclick = function () {
    dropdown.style.visibility = "visible";
};

var dropdown = document.createElement('DIV');
dropdown.style.backgroundColor = 'white';
dropdown.style.borderStyle = 'solid';
dropdown.style.borderWidth = '2px';
dropdown.style.cursor = 'pointer';
dropdown.style.textAlign = 'left';
dropdown.style.width = '150px';

var chkRed = document.createElement("input");
chkRed.type = "checkbox";
chkRed.id = "chkRed";
chkRed.value = "Red";
chkRed.checked = false;
var lblRed = …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-plugins jquery-ui-datepicker

19
推荐指数
2
解决办法
3万
查看次数

请求的性能计数器不是自定义计数器,必须初始化为ReadOnly."在RouteTable.Routes.MapHubs();

我在AspNet MVC 4应用程序中使用SignalR 1.1.2版本和Windsor Castle.我的问题是,自从我转移到较新的SignalR版本后,此错误消息显示出来.

"The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly."
Run Code Online (Sandbox Code Playgroud)

在线

    RouteTable.Routes.MapHubs();
Run Code Online (Sandbox Code Playgroud)

这是RegisterHubs类

public static class RegisterHubs
{
    public static void Start()
    {
        var signalrDependencyContainer = new WindsorContainer().Install(new HubsInstaller());
        var signalrDependency = new SignalrDependencyResolver(signalrDependencyContainer.Kernel);
        GlobalHost.DependencyResolver = signalrDependency;
        RouteTable.Routes.MapHubs();
    }
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试了一些我在互联网上找到的东西,比如:

lodctr /R
cd C:\Windows\Inf\.NETFramework
lodctr corperfmonsymbols.ini
Run Code Online (Sandbox Code Playgroud)

但我仍然收到相同的错误消息.有任何想法吗?

我正在使用dotnet framework 4.5.

这是堆栈跟踪

at System.Diagnostics.PerformanceCounter.InitializeImpl()
Run Code Online (Sandbox Code Playgroud)

谢谢!

更新 我正在添加Drew请求的屏幕截图. 在此输入图像描述

在此输入图像描述

在此输入图像描述

c# asp.net signalr signalr-hub

17
推荐指数
2
解决办法
2万
查看次数

Google Play服务示例:"connectionResult无法解析"

当我试图按照如何检查是否安装了Google Play服务的示例时,我收到以下错误:serviceConnected方法中的行中的"connectionResult无法解析"

int errorCode = connectionResult.getErrorCode();
Run Code Online (Sandbox Code Playgroud)

有什么可以遗漏?我正在复制并粘贴它.我在这里关注这个例子

谢谢!

android google-play-services

14
推荐指数
1
解决办法
5641
查看次数

包含循环,如果禁用参考跟踪,则无法序列化,json.net和webapi

我收到错误:

 Object graph for type 'System.Collections.Generic.List`1[[Proj.Model.Prom, Proj.Model, 
 Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' contains cycles and cannot be 
 serialized if reference tracking is disabled.
Run Code Online (Sandbox Code Playgroud)

读到这一点,似乎是序列化器,但Json.Net声称是解决方案,我读过WebApi,而Framework 4.5默认使用它.所以它是默认出现的吗?如果是这样,为什么我仍然会收到该错误?

谢谢!吉列尔莫.

编辑:添加代码

using System;
using System.Collections.Generic;
using System.Data.Spatial;

namespace Proj.Model
{
    public class Prom
    {
        public Prom()
        {
            this.Stores = new List<Store>();
            this.Branches = new List<Branch>();
            this.Products = new List<Product>();
        }

        public int Id { get; set; }
        public string Name { get; set; }
        public DbGeography Location { get; set; }
        public string Latitude { get; …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework ef-code-first asp.net-web-api entity-framework-5

12
推荐指数
1
解决办法
2万
查看次数

标签:TextLayoutCache文本:缓存值已删除

在某些时候调试我的Android应用程序时,我在LogCat中看到了大量的条目

Tag: TextLayoutCache Text: Cache Value 0x51b9f578 deleted, size=168 (the hexa value changes from entry to entry)
Run Code Online (Sandbox Code Playgroud)

有谁知道这是关于什么的?内存泄漏?如果有问题,如何解决它的任何想法?谢谢!

android textview android-layout

11
推荐指数
1
解决办法
2720
查看次数

Android Application对象生命周期

我找不到Application的对象(扩展Application)生命周期.例如,如果我有一个通过Alarm调用的广播接收器会发生什么.Application中的方法会被调用吗?或者一切都与应用程序无关?如果我在Application中实例化了datahelper并且我从广播接收器中调用它,它是否可用?哪个是Application对象生命周期,什么时候被销毁?什么时候使用警报时调用它?当活动不在Application对象的前台时会发生什么?提前致谢.吉列尔莫.

lifecycle android broadcastreceiver

10
推荐指数
1
解决办法
3884
查看次数

使用ASPNET MVC 4和webapi自定义httphandler和routehandler

我正在研究ASPNET MVC 4和WebApi.webapi方法将由移动设备使用.我们需要保护服务,我们正在使用的是以某种特定方式加密数据.

现在,我需要在到达控制器之前解密呼叫.如果解密的信息有效,它应该像往常一样继续到控制器,如果没有,我将路由用户一些错误方法.

为了实现这一点,我认为最好的选择是自定义HttpHandler和自定义RouteHandler.我在这里按照教程

 public class MvcSecurityRouteHandler:IRouteHandler 
   { 
       public System.Web.IHttpHandler GetHttpHandler(RequestContext requestContext) 
       { 
          return new MvcSecurityHttpHandler(requestContext); 
       }
   }

public class MvcSecurityHttpHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState, IRouteHandler
    {
        public RequestContext RequestContext { get; set; }

        public MvcSecurityHttpHandler(RequestContext requestContext)
        {
            this.RequestContext = requestContext;
        }

        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext httpContext)
        {
            var controllerId = RequestContext.RouteData.GetRequiredString("controllerId");
            IController controller = null;
            IControllerFactory factory = null;
            try
            {
                factory = ControllerBuilder.Current.GetControllerFactory();
                controller = factory.CreateController(RequestContext, controllerId); …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc asp.net-mvc-4 asp.net-web-api asp.net-web-api-routing

10
推荐指数
1
解决办法
3万
查看次数