我将尽可能详细地解释我的问题,我将不胜感激任何帮助/建议.我的问题是由两个查询(一次插入和一次更新)引起的死锁.我正在使用MS-SQL server 2008
我有两个使用相同数据库的应用程序:
Web应用程序在不使用事务的情况下插入展示记录,而Windows服务应用程序在使用IsolationLevel.ReadUncommitted事务时计算展示次数.Windows服务应用程序中的存储过程执行以下操作:
Windows服务存储过程:
循环通过将isCalculated标志设置为false并且日期<@now的所有展示,增加计数器和连接到展示表的另一个表中的其他数据,并isCalculated在具有日期<@now的展示中将标记设置为true.因为这个存储过程非常大,没有必要粘贴它,这里是proc的缩短代码片段:
DECLARE @nowTime datetime = convert(datetime, @now, 21)
DECLARE dailyCursor CURSOR FOR
SELECT Daily.dailyId,
Daily.spentDaily,
Daily.impressionsCountCache ,
SUM(Impressions.amountCharged) as sumCharged,
COUNT(Impressions.impressionId) as countImpressions
FROM Daily INNER JOIN Impressions on Impressions.dailyId = Daily.dailyId
WHERE Impressions.isCharged=0 AND Impressions.showTime < @nowTime AND Daily.isActive = 1
GROUP BY Daily.dailyId, Daily.spentDaily, Daily.impressionsCountCache
OPEN dailyCursor
DECLARE @dailyId int,
@spentDaily decimal(18,6),
@impressionsCountCache int,
@sumCharged decimal(18,6),
@countImpressions int
FETCH NEXT FROM dailyCursor INTO @dailyId,@spentDaily, …Run Code Online (Sandbox Code Playgroud) 我知道这看起来有点长,但我试图尽可能地解释这个问题.
我们对linq to sql数据上下文类有一个非常"异乎寻常"的问题.我们有一个n层结构,结构如下:我们有3个类MotherClass,ChildClass,ChildChildrenClass
public class MotherClass
{
private EntitySet<ChildClass> _Children;
[Column]
public int Id { get; set; }
[Association(Storage = "_Children", ThisKey = "Id", OtherKey = "MotherId")]
public EntitySet<ChildClass> Children
{
get { return _Children; }
set { _Children= value; }
}
}
Run Code Online (Sandbox Code Playgroud)
public class ChildClass
{
private EntityRef<MotherClass> _Mother;
private EntitySet<ChildChildrenClass> _ChildChildren;
[Column]
public int Id { get; set; }
[Column]
public int MotherId { get; set; }
[Association(Storage = "_Mother", IsForeignKey = true, ThisKey = …Run Code Online (Sandbox Code Playgroud) 我有一个托管在IIS7服务器上的.net 4.0 Web应用程序.
阅读本文后:http://learn.iis.net/page.aspx/496/iis-url-rewriting-and-aspnet-routing/关于从另一台服务器提供静态内容,以便每次请求都不会发送cookie对于静态文件,我尝试了但没有太大的成功.
这是在web.config文件中编写的部分:
<system.webServer>
<rewrite>
<rules>
<rule name="images" stopProcessing="true">
<match url="^images/(.*)$" />
<action type="Rewrite" url="http://static-server.com/images/{R:1}" appendQueryString="true" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
定义此规则后,应将映像文件夹中文件的每个链接重写到静态服务器URL中.但这根本不起作用,现在images文件夹中的每个图像都返回404未找到的图像.任何可能导致此行为的想法,或者如何从不同服务器的特定文件夹中提供文件的不同解决方案,而不必通过大量代码并更改链接到静态服务器的所有链接?
我也尝试使用重定向操作类型而不是实际工作的重写操作,但它无法解释为什么我试图在不同的服务器上提供文件的原因(这种方式请求被发送到我的动态内容服务器所有必需的cookie并重定向到静态服务器,这实际上比从动态内容服务器提供图像更糟糕.