我有一个现有的页面,我需要删除一个带有可以动态加载的控制器的角度应用程序.
这是一个片段,它根据API和我发现的一些相关问题实现了我应该如何完成的最佳猜测:
// Make module Foo
angular.module('Foo', []);
// Bootstrap Foo
var injector = angular.bootstrap($('body'), ['Foo']);
// Make controller Ctrl in module Foo
angular.module('Foo').controller('Ctrl', function() { });
// Load an element that uses controller Ctrl
var ctrl = $('<div ng-controller="Ctrl">').appendTo('body');
// compile the new element
injector.invoke(function($compile, $rootScope) {
// the linker here throws the exception
$compile(ctrl)($rootScope);
});
Run Code Online (Sandbox Code Playgroud)
JSFiddle.请注意,这是实际事件链的简化,上面的行之间有各种异步调用和用户输入.
当我尝试运行上面的代码时,$ compile返回的链接器抛出:Argument 'Ctrl' is not a function, got undefined.如果我正确理解了引导程序,它返回的注入器应该知道Foo模块,对吧?
相反,如果我使用一个新的注入器angular.injector(['ng', 'Foo']),它似乎工作,但它创建一个新的$rootScope,不再与Foo模块被引导的元素相同的范围. …
我有Windows服务,在最终用户的计算机上侦听https请求,在这种情况下是否有可接受的创建或分发私钥的方法?我是否应该打包专门针对localhost请求的真正密钥(例如local.mydomain.com)或生成自签名密钥并在安装时添加受信任的根CA?
如果重要,该服务使用Nancy Self Host处理请求,并在SYSTEM用户上运行.我们有一个运行在https上的Web应用程序,它将向服务发出CORS请求,用户将在标准Web浏览器(> = IE10)上使用它.只有安装了服务的机器才会向其发出请求.
谢谢.
我有一个连接到 SQL Server 2014 数据库的应用程序,该数据库将多行合并为一行。应用程序运行时,没有与此数据库的其他连接。
首先,在特定时间跨度内选择一组行。此查询使用与集群查找合并的非集群查找(TIME 列)。
select ...
from FOO
where TIME >= @from and TIME < @to and ...
Run Code Online (Sandbox Code Playgroud)
然后,我们在 c# 中处理这些行并将更改写入单个更新和多个删除,这在每个块中发生多次。这些也使用非聚集索引查找。
begin tran
update FOO set ...
where NON_CLUSTERED_ID = @id
delete FOO where NON_CLUSTERED_ID in (@id1, @id2, @id3, ...)
commit
Run Code Online (Sandbox Code Playgroud)
使用多个并行块运行此程序时出现死锁。我尝试使用ROWLOCKfor updateanddelete但由于某种原因导致比以前更多的死锁,即使块之间没有重叠。
然后我尝试TABLOCKX, HOLDLOCK了update,但这意味着我无法select并行执行我的操作,因此我失去了并行性的优势。
知道如何避免死锁但仍处理多个并行块吗?
鉴于块之间没有行重叠,在这种情况下NOLOCK在 my上使用是否安全select?那么TABLOCKX, HOLDLOCK只会阻止updateand delete,对吗?
或者我应该接受死锁会发生并在我的应用程序中重试查询?
更新(附加信息):到目前为止,所有死锁都发生在update和delete阶段,没有发生在 …
我试图使用CryptUnprotectData读取使用密码保护的CryptProtectData进入SecureString,并用它来连接到数据库.我可以输出正确的密码,但尝试创建新的密码SqlConnection失败后出现以下情况:
System.TypeInitializationException was unhandled
HResult=-2146233036
Message=The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.
Source=System.Data
TypeName=System.Data.SqlClient.SqlConnection
StackTrace:
at System.Data.SqlClient.SqlConnection..ctor()
at System.Data.SqlClient.SqlConnection..ctor(String connectionString, SqlCredential credential)
at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
at ProtectedSqlTest.Program.Main() in C:\Git\ProtectedSqlTest\ProtectedSqlTest\Program.cs:line 16
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object …Run Code Online (Sandbox Code Playgroud) angularjs ×1
c# ×1
deadlock ×1
https ×1
javascript ×1
pinvoke ×1
securestring ×1
self-hosting ×1
sql ×1
sql-server ×1
ssl ×1