小编kos*_*kov的帖子

visual studio 2010 jquery和ScriptManager导致错误

我刚刚安装了新的visual studio 2010,当我创建新的表单并添加jquery avaliable和scriptmanager时,firefox会向我显示一个错误的Sys.ArgumentException:找不到id为'form1'的元素.参数名称:elementOrElementId

表格看起来像这样

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript" />
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>


    </div>
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

html asp.net jquery

4
推荐指数
1
解决办法
4518
查看次数

实体数据查询和内存泄漏

我在循环中下载了大量数据但是在一些操作之后我删除了它们但是我看到内存分配正在快速增长,几秒钟和1GB,所以如何在每次迭代后清理?

    using (var contex = new DB)
    {

        var inputs = contex.AIMRInputs.Where(x => x.Input_Type == 1);

        foreach (var input in inputs)
        {
            var data = contex.Values.Where(x => x.InputID == input.InputID).OrderBy(x => x.TimeStamp).ToList();

            if (data.Count == 0) continue;
            foreach (var value in data)
            {
               Console.WriteLine(Value.property);
            }
            data.Clear();


        }
    }
Run Code Online (Sandbox Code Playgroud)

c# memory-leaks entity-framework

4
推荐指数
1
解决办法
6143
查看次数

Kendo Grid阻止默认请求

有没有办法防止默认的ajax请求?我将在java脚本中进行所有配置之后刷新网格,然后我开始请求,但不知何故,这个kendo网格是在加载页面时自动请求数据.

@(Html.Kendo().Grid<Data>()
    .Name("grid")
    .HtmlAttributes(new { Class = "acceleratorGrid" })
    .TableHtmlAttributes(new { Class = "styled", cellpadding = "0", border = "0", margin = "0" })
    .Events(e => e.Change("onChange"))
    .DataSource(dataSource => dataSource // Configure the grid data source
                                .Ajax() // Specify that ajax binding is used
                                .Read(read => read.Action("Products_Read", "Home")) // Set the action method which will return the data in JSON format
    )
    .Columns(columns =>
                {

                    columns.Bound(product => product.ProductID).Template(@<text></text>).ClientTemplate("<input type='checkbox' onclick='return false' name='checkedRecords' />");
                    columns.Bound(product => product.ProductName);
                    columns.Bound(product => product.UnitsInStock);
                } …
Run Code Online (Sandbox Code Playgroud)

kendo-ui kendo-grid kendo-asp.net-mvc

4
推荐指数
1
解决办法
5770
查看次数

rxjs中的mergeMap服务6

我正在尝试根据角度5到6的某个模板升级我的项目

其中一个方法以这种方式返回mergeMap

return this.accountEndpoint.getUserByUserNameEndpoint<User>(userOrUserId.userName)
                    .mergeMap(user => this.deleteUser(user.id));
Run Code Online (Sandbox Code Playgroud)

和其他一些以这种方式返回

 this.accountEndpoint.getDeleteUserEndpoint<User>(<string>userOrUserId)
                 .do(data => this.onRolesUserCountChanged(data.roles));
Run Code Online (Sandbox Code Playgroud)

遗憾的是,mergeMap和do在rxjs 6中的observable中不存在

Couuld给我一个暗示如何在rxjs 6的新世界中映射?

rxjs angular angular6 rxjs6

4
推荐指数
1
解决办法
4929
查看次数

在 appsettings.json 中更改日志级别不会应用于 NLog

我将 NLog 与 dotnet 核心应用程序一起使用,配置如下所述。https://github.com/NLog/NLog.Web/wiki/Getting-started-with-ASP.NET-Core-2

在 nlog.config 中,如果我将 minLevel 设置为 Error 并启动我的应用程序,我可以在记录器上看到 logDebug 被禁用。

如果我恢复到跟踪然后所有级别都设置为 true (error, trace, debug, info, warning)

如果我把它放到配置文件(appsettings.json)中

"Logging": {
        "LogLevel": {
            "Default": "Error",
            "Microsoft": "Information"
        }
    }
Run Code Online (Sandbox Code Playgroud)

然后什么也没有发生,所有记录器级别仍然设置为 true,可能有什么问题? 在此处输入图片说明

c# nlog .net-core

4
推荐指数
1
解决办法
2159
查看次数

在OAuth2中刷新令牌有什么好处

基于OAuth 2.0协议 Refresh Tokens用于重新验证访问令牌,主要通过将刷新令牌保存到数据库并控制它们来维护撤销.这样做有什么好处?为什么不自救Access Token呢?

security oauth oauth-2.0

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

CREATE DATABASE或ALTER DATABASE失败,因为最终的累积数据库大小将超出每个数据库10240 MB的许可限制

我的SQL Server不是Express,并且当db增长到10240时出现错误:

由于“ PRIMARY”文件组已满,无法为数据库中的对象分配空间。通过删除不需要的文件,在文件组中删除对象,向文件组添加其他文件或为文件组中的现有文件设置自动增长来创建磁盘空间。

我试图将“初始大小”从10240更改为更多,但出现错误:

CREATE DATABASE或ALTER DATABASE失败,因为最终的累积数据库大小将超出每个数据库10240 MB的许可限制。(Microsoft SQL Server,错误:1827)

但这实际上不是Express,而是完整的SQL Server,那么它怎么可能有此限制?

sql sql-server sql-server-2008

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

返回表达式而不是结果

如果我有这样的功能

double GetExpression(int x, int y, int z)
{
    return x * y + z;
}
Run Code Online (Sandbox Code Playgroud)

有可能以某种方式修改它,不立即返回结果只是一些表达式的对象,然后以这种方式评估它:

var expression = GetExpression(1,2,3);
double result = expression.Execute() or expression.Evaluate()
Run Code Online (Sandbox Code Playgroud)

换句话就是返回功能?

c#

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

任务调度程序过早地运行任务几毫秒

我有一个触发器的任务:

At 0:00 every day - after triggered, repeat every 1 hours for a duration of 1 day.
Run Code Online (Sandbox Code Playgroud)

在我的应用程序中,我以这种方式阅读时间:

dateTimeUtcNow = DateTime.Now;
Run Code Online (Sandbox Code Playgroud)

有时候,很少有人将dateTimeUtcNow显示为整整一小时之前几毫秒的时间 2015-11-11 14:59:59,914

服务器在Windows Server 2012 R2上运行,我可以在家庭版本上接受这个,但不能生产.

为什么?这是一个错误吗?我怎么能阻止这个?

c# windows-server-2008-r2 taskscheduler

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

LINQ表达式无法转换为基本属性

我有自定义的OrderBy实现,它仅适用于没有继承的类型,如果我想按基本类型的字段进行排序,则无法翻译LINQ表达式

public static IOrderedQueryable<TEntity> OrderBy<TEntity>(this IQueryable<TEntity> source, string orderByProperty, bool desc)
{
    if (source == null)
    {
        throw new ArgumentNullException(nameof(source));
    }

    if (string.IsNullOrEmpty(orderByProperty))
    {
        throw new ArgumentNullException(nameof(orderByProperty));
    }

    var command = desc ? "OrderByDescending" : "OrderBy";

    var type = typeof(TEntity);

    var param = Expression.Parameter(type, "p");
    var property = type.GetProperty(orderByProperty);
    var propertyAccess = Expression.MakeMemberAccess(param, property);
    var orderByExpression = Expression.Lambda(propertyAccess, param);
    var resultExpression = Expression.Call(
            typeof(Queryable),
            command,
            new Type[] { type, property.PropertyType },
            source.Expression,
            Expression.Quote(orderByExpression));
    return (IOrderedQueryable<TEntity>)source.Provider.CreateQuery(resultExpression);
}
Run Code Online (Sandbox Code Playgroud)

我正在使用entityframework core 2.2,但是非常有趣的事情是,如果我只是编写它,source.OrderBy(x=>x.someBaseField) …

c# entity-framework-core .net-core

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