我们正在使用Entity Framework并在事务范围内运行单元测试.我们原来在标题中得到了错误.
我设法将问题与某些问题隔离开来.
using (TransactionScope scope1 = new TransactionScope())
{
using (TransactionScope scope2 = new TransactionScope())
{
// Here there is no code
}
using (Entities se = new Entities())
{
EntityConnection entityConnection = (EntityConnection)se.Connection;
DbConnection storeConnection = entityConnection.StoreConnection;
storeConnection.Open(); // On this line the error occurs
// Some code that runs a stored procedure
}
}
Run Code Online (Sandbox Code Playgroud)
我们当前得到的错误是"操作对事务状态无效......"
如果我删除事务scope2,一切正常.
如果我将范围2标记为环境事务,它也可以正常工作.
我正在编写代码来测试一个网站的性能.我有以下代码:
string url = "http://xxxxxx";
System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
System.Diagnostics.Stopwatch totalTime = new System.Diagnostics.Stopwatch();
totalTime.Start();
for (int i = 0; i < 10; i++)
{
stopwatch.Start();
WebRequest request = HttpWebRequest.Create(url);
WebResponse webResponse = request.GetResponse();
webResponse.Close();
stopwatch.Stop();
textBox1.Text += "Time Taken " + i.ToString() + " = " + stopwatch.Elapsed.Milliseconds.ToString() + Environment.NewLine;
stopwatch.Reset();
}
totalTime.Stop();
textBox1.Text += "Total Time Taken = " + totalTime.Elapsed.Milliseconds.ToString() + Environment.NewLine;
Run Code Online (Sandbox Code Playgroud)
这给出了以下结果:
Time Taken 0 = 88
Time Taken 1 = 161
Time Taken 2 …Run Code Online (Sandbox Code Playgroud) 我们目前正在从使用stsadm转向使用PowerShell进行SharePoint安装脚本.
我们无法找到对此的等效:
stsadm -o -execadmsvcjobs
Run Code Online (Sandbox Code Playgroud)
我们尝试暂停,但它会改变暂停需要多长时间.
PowerShell中是否存在等效命令,或者我们是否可以从PowerShell运行此命令?
我们正在构建Exchange 2010的集成.
当我们通过Outlook查看联系人时,该人员的图片下方有一个"备注"字段,其中包含更新信息.
我们能够在其他字段中找到数据,但不能找到这个数据.任何人都知道该字段的调用内容或数据的存储位置.
我试图从存储过程返回最后插入行的标识.
我的代码的简化版本如下所示:
CREATE PROCEDURE [sp_name]
@AuthorisationCode uniqueidentifier
AS
INSERT INTO [tablename]
([AuthorisationCode]
)
VALUES
(@AuthorisationCode
)
RETURN @@IDENTITY
GO
Run Code Online (Sandbox Code Playgroud)
我通过Enterprise Library 4.1中的Execute Scalar调用此存储过程.
它返回null.有人看到我做错了什么.
c# sql enterprise-library sql-server-2008 enterprise-library-4.1
我们有两个大型解决方案文件,我们希望将它们合并为一个解决方案。
我们可以将解决方案 A 中的项目添加到解决方案 B。但是想知道是否有更省时的方法来做到这一点?
我正在审查一个使用Microsoft Patterns and Practices Unity Container的项目.
有一个容器有40个注册类型,为每个Web服务调用创建一个容器实例.
我想知道:
Web服务托管在IIS中.
我们有一个没有收藏夹图标的网站.
因此,我们为文件favicon.ico获取了大量的http 404错误.
对于网站的功能,它没有任何区别.
但我想知道系统是否会花更多的时间寻找不存在的文件,而不是返回未修改的304?
在最大负载时,我们有大约.所有前端服务器上的15,000个并发连接.
我试图用svcutil自动生成一些代码.我在xsd中有以下内容:
<xs:complexType name="ForsikringstilfelleDetalj">
<xs:sequence>
<xs:element name="detaljID" type="xs:string" minOccurs="0" maxOccurs="1"/>
Run Code Online (Sandbox Code Playgroud)
然后我运行以下命令:
svcutil xx.wsdl yy.xsd /ct:System.Collections.Generic.List`1
Run Code Online (Sandbox Code Playgroud)
然后我得到以下C#代码:
public ForsikringstilfelleDetalj[] forsikringstilfelle
Run Code Online (Sandbox Code Playgroud)
我想要的是:
public List<ForsikringstilfelleDetalj> forsikringstilfelle
Run Code Online (Sandbox Code Playgroud)
根据网上的信息,/ ct选项应告诉svcutil使用通用列表进行集合.谁能看到我做错了什么?
c# ×6
performance ×2
.net-4.0 ×1
architecture ×1
asp.net ×1
http ×1
iis-7.5 ×1
installation ×1
merge ×1
powershell ×1
sharepoint ×1
spring-batch ×1
sql ×1
svcutil.exe ×1
transactions ×1
web-services ×1