小编Ken*_*ith的帖子

实体框架6生成的非常低效的查询

这是我想要的查询:

select top 10 *
from vw_BoosterTargetLog
where OrganizationId = 4125
order by Id desc
Run Code Online (Sandbox Code Playgroud)

它执行亚秒.

这是我的实体框架(6.1.2)在C#中的等价物:

return await db.vw_BoosterTargetLog
    .Where(x => x.OrganizationId == organizationId)
    .OrderByDescending(x => x.Id)
    .Take(numberToRun)
    .ToListNolockAsync();
Run Code Online (Sandbox Code Playgroud)

这是它生成的SQL:

SELECT TOP (10) 
    [Project1].[OrganizationId] AS [OrganizationId], 
    [Project1].[BoosterTriggerId] AS [BoosterTriggerId], 
    [Project1].[IsAutomatic] AS [IsAutomatic], 
    [Project1].[C1] AS [C1], 
    [Project1].[CustomerUserId] AS [CustomerUserId], 
    [Project1].[SourceUrl] AS [SourceUrl], 
    [Project1].[TargetUrl] AS [TargetUrl], 
    [Project1].[ShowedOn] AS [ShowedOn], 
    [Project1].[ClickedOn] AS [ClickedOn], 
    [Project1].[BoosterTargetId] AS [BoosterTargetId], 
    [Project1].[TriggerEventGroup] AS [TriggerEventGroup], 
    [Project1].[TriggerIgnoreIdentifiedUsers] AS [TriggerIgnoreIdentifiedUsers], 
    [Project1].[TargetTitle] AS [TargetTitle], 
    [Project1].[BoosterTargetVersionId] AS [BoosterTargetVersionId], 
    [Project1].[Version] AS [Version], 
    [Project1].[CookieId] …
Run Code Online (Sandbox Code Playgroud)

c# sql-server entity-framework

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

双工WCF服务在第11次呼叫时挂起

我有一个双工WCF服务,它在魔法10代理实例化后挂起.客户端上的具体错误是:

"System.TimeoutException:发送到net.tcp:// localhost:8080/RoomService/netTcp的请求操作未在配置的超时(00:00:59.9960000)内收到回复".

服务器上没有任何明显的错误消息.

请注意,这不是标准的,明显的问题,即无法关闭我的代理连接,因为我正在关闭我的代理连接的每个实例,然后再打开下一个:

try
{
    client.Close();
}
catch (CommunicationException)
{
    client.Abort();
}
catch (TimeoutException)
{
    client.Abort();
}
catch (Exception)
{
    client.Abort();
    throw;
}
Run Code Online (Sandbox Code Playgroud)

我已经将我的节流行为设置为500个同步所有内容:

ServiceThrottlingBehavior throttlingBehavior = new ServiceThrottlingBehavior()
{
    MaxConcurrentCalls = 500,
    MaxConcurrentSessions = 500,
    MaxConcurrentInstances = 500
};
Run Code Online (Sandbox Code Playgroud)

我已将我的服务的ConcurrencyMode设置为Multiple,并且我已经为InstanceContextMode尝试了所有三个可能的值.

[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]
Run Code Online (Sandbox Code Playgroud)

我尝试过自托管服务,并在IIS中托管它,我在每个服务器上得到相同的结果.

我已经尝试过NetTcpBinding,WSDualHttpBinding和PollingDuplexBinding(在Silverlight上),每个都有相同的结果.我无法尝试BasicHttpBinding或WSHttpBinding,因为这是一个双工服务.

在我的代码中有一个地方我正在启动多个线程(同时执行多个回调),但出于故障排除的目的,我已经评论了这一点,并没有产生任何影响.

在客户端上,我尝试过为每个测试使用新代理,并在所有测试中重用相同的代理,但没有任何运气.我已经尝试为每个代理创建一个新的InstanceContext,并在所有代理中重用相同的InstanceContext,再次,没有运气.

无论我做什么,在我的测试工具中执行第10次测试后,下一次调用服务都会挂起.

关于我可能做错什么的任何想法?

wcf duplex

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

导出TypeScript模块会导致接口无法被拾取

我一起使用TypeScript和SignalR,并且我正在尝试为生成的SignalR类定义静态类型.如果我做这样的事情,它的工作原理:

///<reference path="../Scripts/jquery-1.8.d.ts" />
///<reference path="../Scripts/signalr-1.0.d.ts" />

interface SignalR {
    roomHub: Service.RoomHub;
}

module Service {
        export var roomHub = $.connection.roomHub;
        export interface RoomHub { }
}
Run Code Online (Sandbox Code Playgroud)

当然$.connection是类型SignalR,它在文件"signalr-1.0.d.ts"中定义,并在上面的文件中扩展.

但是,我需要能够Service从其他文件引用该模块,因此我需要在模块和接口中添加"export"关键字,即:

///<reference path="../Scripts/jquery-1.8.d.ts" />
///<reference path="../Scripts/signalr-1.0.d.ts" />

export interface SignalR {
    roomHub: Service.RoomHub;
}

export module Service {
    // Error here: "The property 'roomHub' does not exist on type SignalR."
    export var roomHub = $.connection.roomHub;
    export interface RoomHub { }
}
Run Code Online (Sandbox Code Playgroud)

但是,当我这样做时,我得到一条红色的小波浪线$.connection.roomHub,并且编译器返回错误,"属性'roomHub'在SignalR类型上不存在."

我当然不了解TypeScript的所有内容,但这对我来说似乎并不合适.我遇到了编译器错误吗?或者有不同的方法来做到这一点?

signalr typescript

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

部署到Azure网站时,Microsoft.VisualStudio.QualityTools.UTFResources的FileNotFoundException

我正在使用Azure网站git deploy(通过Kudu),一切都很顺利,直到今天.当我执行新的git push并尝试部署时,我在测试运行时收到此错误消息:

错误:System.IO.FileNotFoundException:无法加载文件或程序集"Microsoft.VisualStudio.QualityTools.UTFResources,Version = 10.1.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a"或其依赖项之一.该系统找不到指定的文件.

在上次成功推送和我开始收到此错误之间,我没有添加或删除我的解决方案中的任何库或其他引用.谷歌搜索没有任何结果.该文件位于我的本地GAC中,但我无法在我的解决方案中的任何位置直接引用它.

重新部署我的解决方案的版本 - 在当天早​​些时候正确部署的版本 - 失败,并显示相同的错误消息.

如果我不知道更好的话,我会认为MS改变了一些东西而且打破了kudu.

有关解决此问题的任何想法,不愿意用Azure打开票证吗?

编辑 - 更多详情:

运行单元测试时失败了.这是我的deploy.cmd的相关部分:

:: 1. Build to the temporary path
IF /I "%IN_PLACE_DEPLOYMENT%" NEQ "1" (
  %MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\Payboard.Web\Payboard.Web.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="%DEPLOYMENT_TEMP%";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
) ELSE (
  %MSBUILD_PATH% "%DEPLOYMENT_SOURCE%\Payboard.Web\Payboard.Web.csproj" /nologo /verbosity:m /t:Build /p:AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="%DEPLOYMENT_SOURCE%\.\\" %SCM_BUILD_ARGS%
)

IF !ERRORLEVEL! NEQ 0 (
    echo Build failed with ErrorLevel !0!
    goto error
)

:: 2. Building test projects
rem echo Building …
Run Code Online (Sandbox Code Playgroud)

azure azure-web-sites kudu

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

不正确的Resharper 9/TypeScript错误的解决方法?

我刚刚安装了Resharper 9,我很喜欢它改进的Typescript支持.但是我在这样的场景中遇到了错误:

module Test {
    export function sayHello() {
        alert('Hi!');
    }
}

Test.sayHello = () => console.log('Hi!');
Run Code Online (Sandbox Code Playgroud)

这是一个完全有效的Typescript语法(它编译并运行时没有任何错误或警告),并且非常方便用于模拟场景等等.但是,Resharper 9将最后一行标记为错误:

The left hand side of an assignment expression must be a variable, property or indexer.
Run Code Online (Sandbox Code Playgroud)

现在,Resharper不是TS编译器,所以理论上我可以忽略错误,但是当我的一个文件中存在数十个这些不准确的错误评估时,它隐藏了合法错误.

我一直无法弄清楚如何关闭这一点错误检查.我已将此报告为一个错误,并且可能他们最终会修复它,但与此同时,它会让人分心.

对于一个变通方法的任何建议,害羞回到Resharper 8?

resharper typescript resharper-9.0

0
推荐指数
1
解决办法
563
查看次数