我有一个每X分钟运行一次的服务.如果由于某些不可预见的原因,该作业的耗时超过X分钟,我想确保触发器不会启动此作业的第二个实例.
示例场景
有没有办法连接Quartz.NET只允许1个Job的实例?我可以用第二个触发器等待第一个触发完成,或者我也可以选择跳过第二个触发器,因为它会在一分钟内再次触发.
我看了一下Quartz API的Java版本,发现了一个属性' DisallowConcurrentExecution ',但是在.NET版本中找不到类似的东西.
我的Quartz.NET实现代码
public IScheduler Scheduler { get; set; }
public IJobListener AutofacJobListener { get; set; }
public void Start()
{
var trigger = TriggerUtils.MakeMinutelyTrigger(1);
trigger.Name = @"Document Import Trigger";
Scheduler.ScheduleJob(new JobDetail("Document Import", null, typeof(DocumentImportJob)), trigger);
Scheduler.AddGlobalJobListener(AutofacJobListener);
Scheduler.Start();
}
我注意到自安装Visual Studio 2010 SP1以来我遇到了巨大的性能问题.它将随机冻结我很多.
在升级之前,我没有使用Visual Studio 2010的性能问题.我运行的唯一附加组件是ReSharper.
我想知道是否有其他人遇到性能问题?如果是这样,你找到了修复它们的方法吗?
我有一个需要拖放功能的Silverlight应用程序,因为我允许用户拖放文件以上传到系统中.
但是我遇到的问题是导航总是落后于Silverlight应用程序.我尝试打开"无窗口",但不得不将其关闭,因为我丢失了拖放功能(微软不支持)
我需要做些什么来使我的导航显示在silverlight应用程序的顶部(param name ="Windowless"value ="true"不是一个选项,除非有一种方法可以通过拖放使用它)?
<div id="silverlightControlHost" style="float:left; width:400px; height:300px;"> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="220px"> <param name="source" value="../ClientBin/FileImport.xap"/> <param name="onError" value="onSilverlightError" /> <param name="background" value="white" /> <param name="minRuntimeVersion" value="4.0.50826.0" /> <param name="autoUpgrade" value="true" /> <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none"> <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/> </a> </object> <iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe> </div>
<div id="NavigationControl"> <ul class="sf-menu sf-js-enabled sf-shadow"> <li><a id="Navigation_1" href="...">Item 1</a></li> <li class="sfHover"><a id="Navigation_2" class="sf-with-ul">Item 2<span class="sf-sub-indicator">»</span></a> <ul style="visibility: visible; display: block;"> <li><a id="Navigation0_1" …
我有一个执行非常糟糕的存储过程.当我声明一个变量时,设置它的值,然后在where子句中使用它,该语句需要一个多小时才能运行.当我在where子句中对变量进行硬编码时,它会在不到一秒的时间内运行.
我开始通过执行计划调查它出了什么问题.看起来当我尝试传递一些声明的变量时,执行计划会创建一些Hash Match,因为它从使用UNION和公用表表达式的视图中选择值.
/************* Begin of Stored Procedure ***************/ CREATE PROCEDURE GetFruit @ColorId bigint, @SeasionId bigint WITH RECOMPILE AS BEGIN SELECT A.Name FROM [Apple_View] A /* This is the view down below */ INNER JOIN [Fruit] F ON ( F.ColorId = @ColorId AND A.FruitId = F.FruitId) WHERE (A.ColorId = @ColorId AND A.SeasonId = @SeasonId) END /************* End of Stored Procedure ***************/ /************* Begin of View ***************/ WITH Fruits (FruitId, ColorId, SeasonId) AS ( -- Anchor member SELECT F.FruitId ,F.ColorId ,F.SeasonId …
我有一个Windows服务,我想确保我的EF ObjectContext在每次运行之间被处理掉.每次执行时,服务运行的时间都会更长.似乎ObjectContext不断增长.我的ObjectContext应该注册不同还是我做错了什么?
我正在做什么的概述.
Walkthru的代码:
当作业运行时,它会在每次运行时调出并获取我的东西需要更长的时间(例如:第一次运行时为2分钟,第二次运行服务时为4分钟,下一次为6分钟,下一次为8,依此类推) .看起来我的ObjectContext每次都变得越来越大.它拉动的数据没有改变,行数和列数仍然相同.所以我认为我的注册错了,是这样的吗?如果没有,你能看到我正在做的事情的问题吗?
程序
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
var configuration =
Host.Configure<MyService>(c =>
{
c.AllowMultipleInstances();
c.WithRegistrations(b => b.RegisterModule(new MyModule()));
}, args);
Host.Start(configuration);
}
}
Run Code Online (Sandbox Code Playgroud)
模
public class MyModule : Module
{
protected override void Load(ContainerBuilder builder)
{
LoadQuartz(builder);
LoadServices(builder);
LoadInfrastructure(builder);
}
private void LoadInfrastructure(ContainerBuilder …
Run Code Online (Sandbox Code Playgroud) 如果我有DateTime date = new DateTime("1/31/2010");
,我打电话date.AddMonth(1)
.我会得到"2/28/2010"还是会因为"2/31/2010"不存在而吓坏了?或者我会得到"2010年3月3日"?
(我也不在Visual Studio附近的计算机上)
我确认正确的值'2.87'进入服务..并且根据EF图表,'Score'字段的类型是'Decimal'...但是在数据库中它只是'2'
[OperationContract]
public void AddHighScore(string strName, decimal dScore, int iLevel)
{
using (SQL2008R2_789485_punkouterEntities1 dc = new SQL2008R2_789485_punkouterEntities1())
{
HighScore oHighScore = new HighScore();
oHighScore.Level = iLevel;
oHighScore.Name = strName;
//oHighScore.Name = dScore.ToString();
oHighScore.Score = dScore;
dc.AddToHighScores(oHighScore);
dc.SaveChanges();
}
}
-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------
-- Creating table 'HighScores'
CREATE TABLE [dbo].[HighScores] (
[Id] int IDENTITY(1,1) NOT NULL,
[Name] nvarchar(max) NOT NULL,
[Score] decimal(18,0) NOT NULL,
[Level] int NOT NULL
);
GO
Run Code Online (Sandbox Code Playgroud) 可能的重复:
JavaScript 浮点数问题的优雅解决方法
为什么使用javascript将2个数字相加时,会返回疯狂的小数点数?
如果我在纸上加上 285.72 + 142.86 它等于 428.58,你用计算器得到同样的答案。
但是,如果我从 2 个文本框中添加该数字,它将返回 428.58000000000004
我需要我的 javascript 返回 428.58。我知道我可以使用 .toFixed(),但我不想使用,因为我不明白为什么将两个数字相加会在小数点后产生如此疯狂的数字。
我有一个我建立的网站,适用于IE8/IE9,Chrome和FireFox中的每个人.但是,现在我的客户端要求在IE7中工作,因为机器仍然有IE7.我无法弄清楚ReportViewer控件有什么问题.任何帮助,将不胜感激.
问题是我的报告超出了设定的高度和宽度; 它不会留在我使用jQuery包裹它的DIV中
jQuery代码
$(document).ready(function () {
var htmlwidth = $('.main').width() - 20;
var htmlheight = $(document).height() - $('.header').height() - 45;
$('#<%= ReportViewer1.ClientID %>').wrap('<div style="overflow:auto;" />');
$('#<%= ReportViewer1.ClientID %>').parent().css(height, htmlheight);
$('#<%= ReportViewer1.ClientID %>').parent().css('width', htmlwidth);
$('#<%= ReportViewer1.ClientID %>').css('width', htmlwidth);
$('#<%= ReportViewer1.ClientID %>').css(height, htmlheight);
$('#<%= ReportViewer1.ClientID %>').parent().css('border', 'solid 1px Black');
});
Run Code Online (Sandbox Code Playgroud)
内容
<asp:ScriptManager ID="scManager" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Height="100%" Width="100%"
SizeToReportContent="true" ZoomMode="Percent" AsyncRendering="false" >
</rsweb:ReportViewer>
Run Code Online (Sandbox Code Playgroud)
示例生成块{content + jQuery Code}
<div style="width:500px; overflow:auto; border:solid 1px Black;height:400px;">
<asp:ScriptManager ID="scManager" runat="server"></asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Height="400px" …
Run Code Online (Sandbox Code Playgroud) 我刚刚更新了我的nuget包Common.Logging.Log4Net
.从那时起,我不断收到以下错误:
无法从程序集'Common.Logging,Version = 2.2.0.0,Culture = neutral,PublicKeyToken = af08829b84f0328e'加载类型'Common.Logging.Factory.AbstractCachingLoggerFactoryAdapter'
以下是链接到的每个nuget包的列表Common.Logging
以及版本:
在我的web.config中,我有以下几点:
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
//...//
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
//...//
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net">
<arg key="configType" value="FILE-WATCH" />
<arg key="configFile" value="~/log4net.config" />
</factoryAdapter>
</logging>
</common>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我试过改变:
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net">
Run Code Online (Sandbox Code Playgroud)
to(添加版本的Common.Logging.Log4net.dll [201])
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net201">
Run Code Online (Sandbox Code Playgroud)
那不起作用.
.net ×2
decimal ×2
quartz.net ×2
sql ×2
t-sql ×2
addition ×1
asp.net ×1
atlas ×1
autofac ×1
c# ×1
datetime ×1
html ×1
javascript ×1
log4net ×1
nuget ×1
performance ×1
precision ×1
silverlight ×1
sql-server ×1
superfish ×1