小编edo*_*oft的帖子

如何跟踪我的Web服务抛出的IIS 500错误

我已经部署了一个新版本的ASP.NET Web服务.当客户端调用此服务时,IIS日志文件会报告错误代码500.我自己(测试)可以使用该服务而没有任何错误.我在我的ASP.NET webservice中启用了错误记录,但是没有记录错误,这使我相信错误不是由我的代码引发的,而是在堆栈中的"早期"某处.我还检查了httperr1.log文件,但那里没有任何相关内容.

问题,我如何向IIS添加更多错误记录以调查错误?我无法访问客户端.

[更新]我正在使用IIS6.我检查了事件日志,但没有发现任何内容.

iis web-services error-code

6
推荐指数
2
解决办法
3万
查看次数

如何加快加载数据集

使用SQL Server Reporting Services(客户端报告)时,只要客户端(rdlc)报告打开Visual Studio,就会加载整个应用程序数据集,

如何加速加载所有数据集或如何将进程更改为仅加载要在Report中使用的特定数据集?

c# sql-server performance dataset reporting-services

6
推荐指数
1
解决办法
1172
查看次数

如何将比较结果存储到变量中

我想打印一个简单的语句print(1 = 1),我希望结果为TRUE或1但是sql server告诉我:'='附近的语法不正确.这是为什么?

类似的声明也会发生同样的情况

declare @test bit
set @test = (1=1)
Run Code Online (Sandbox Code Playgroud)

总结如何在不使用IF语句的情况下"看到"从比较中返回的内容

更新:我问的原因是因为我正在尝试调试以下语句的原因

declare @AgingAmount smallint
set @AgingAmount = 500
select Amount, datediff(day,Batch.SubmitDate,getdate()) as Aging from myreporrt
where datediff(day,Batch.SubmitDate,getdate()) > @AgingAmount
Run Code Online (Sandbox Code Playgroud)

将返回所有行,即使老化300,所以我想测试datediff(day,datesubmited,getdate())> 500返回true或false但无法找到如何显示此比较结果的方法.

t-sql

6
推荐指数
1
解决办法
3148
查看次数

设置目录的访问权限 - 接收异常"无法设置标志"

我试图progamrtaiclly允许写入目录上的ASPNET帐户.我使用以下代码执行此操作:(请注意,我希望ASPNET的"允许写入访问"也传播到子对象:

static void Main(string[] args)
            {


                FileSecurity fileSecurity;

                fileSecurity = new FileSecurity();

                fileSecurity.SetAccessRuleProtection(true, false);

                fileSecurity.AddAccessRule(new FileSystemAccessRule("ASPNET",FileSystemRights.Write,InheritanceFlags.ObjectInherit|InheritanceFlags.ContainerInherit,PropagationFlags.InheritOnly,AccessControlType.Allow));                                   

                File.SetAccessControl("C:\\TestDir1", fileSecurity);
            }
Run Code Online (Sandbox Code Playgroud)

此代码导致异常:"无法设置标志.\ r \nParameter name:inheritanceFlags"

可能有什么不对?

c# security

5
推荐指数
1
解决办法
4049
查看次数

Linq2SQL:总是让.Sum()返回0而不是null

有没有办法(通过扩展机制?)让Sum()函数全部返回0.

我现在的解决方法是写这样的,但我希望有更好的解决方案?

((int?)e.CampaignCodes.Sum(f => f.Enquiries.Count()) ?? 0),
Run Code Online (Sandbox Code Playgroud)

c# null linq-to-sql

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

IIS和ASP.NET中的时间差异

我正在开发一个ASP.NET(3.5)Web服务应用程序,托管在IIS6/Win2003上.Web服务在开始时和返回之前记录调用的时间戳.这允许我查询所花费的时间.我还添加了标准IIS日志(W3C扩展)的时间

然后对web服务进行压力测试(5个线程,每个线程200个调用)当比较从IIS获取的时间与数据中的timetaken时,我看到了巨大的差异!从IIS(也是调用客户端记录的时间)所花费的时间远远高于ASP.NET记录的时间.例如,根据ASP.NET花费的时间是1.7秒,而IIS则记录12000(毫秒)!

这可能是什么原因?

服务的虚拟代码:

[WebMethod(Description = " Main entry point to the service.")]
public string MethodA(string theXmlInput)
{            
    //log first
    StoreInput(theXmlInput);

    //Run the job, should take about 1 sec
    string result = DoIt(theXmlInput);            

    //log output
    StoreResult(result);

    return result;
}
Run Code Online (Sandbox Code Playgroud)

asp.net iis performance logging iis-6

4
推荐指数
2
解决办法
3001
查看次数

jQuery,尝试在x秒后删除隐藏的div?

嘿那里,我试图有一个div"隐藏",然后一旦隐藏动画完成"删除".似乎我可以得到工作,但不是两者兼而有之.我尝试过使用setTimeout,但这只会导致div被隐藏,但实际上并没有删除.

这是代码:

$(this).parents("div:eq(0)").hide("fast");
setTimeout(function () { $(this).parents("div:eq(0)").remove();}, 1000);
Run Code Online (Sandbox Code Playgroud)

如果我在没有setTimeout的情况下执行删除,则会删除div,但不会显示隐藏动画.

任何帮助赞赏!

jquery hide settimeout

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

我可以在SQL Server报表生成器中使用@table变量吗?

使用SQL Server 2008报表服务:

我正在尝试编写一个显示一些相关数据的报告,所以我想像这样使用@table变量

DECLARE @Results TABLE (Number int
                       ,Name nvarchar(250)
                       ,Total1 money
                       ,Total2 money
                       )

insert into @Results(Number, Name, Total1)
select number, name, sum(total)
from table1
group by number, name

update @Results
set total2 = total
from
(select number, sum(total) from table2) s
where s.number = number

select from @results
Run Code Online (Sandbox Code Playgroud)

但是,报表生成器一直要求输入变量@Results的值。这有可能吗?

编辑:如KM所建议,我已经使用存储过程解决了我的紧迫问题,但原始问题仍然存在:我可以在Report Builder中使用@table变量吗?

sql-server report-designer reporting-services

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

如何将泛型集合指定为泛型方法中的限制

阿罗哈

我有一个带有(伪)签名的方法:

public static T Parse<T>(string datadictionary) where T : List<U>
Run Code Online (Sandbox Code Playgroud)

这不构建.如何限制方法只接受通用的List <>对象(cource不应该包含T,而是其他东西:)

我需要限制T的类型,因为我需要在此代码中调用它的方法.传入的类型是自定义集合(基于List).

public class MyCollection<T> : List<T> where T: MyClass, new()
{
    public void Foo();
}


public static T Parse<T>(string datadictionary) where T : MyCollection<U>
{
    T.Foo();
}
Run Code Online (Sandbox Code Playgroud)

-Edoode

c# generics

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

为什么nlog不能读取当前日期

我正在使用Nlog将一些日志记录写入文本文件.部分nlog.config:

 <target name="file" xsi:type="File" fileName="${basedir}/MBWRunner_log.txt"
             layout="${date} (${level}): ${message}
Exception: ${exception:format=Method, ToString}"/>
Run Code Online (Sandbox Code Playgroud)

日志文件中的行如下所示:

0001-01-01 00:00:00(追踪):MBWRunner开始了

如您所见,日期和时间都是0.我已经测试了{longdate}和{date:format = yyyyMMddHHmmss},结果相同.

该应用程序是一个控制台应用程序,从提升的命令行运行.

有线索吗?

[编辑]我在组织内的2台机器上测试了这个,结果相同.请帮忙!

使用的代码:

  static Logger _logger = LogManager.GetCurrentClassLogger();

public static void Log(string message, LogLevel priority)
    {
      LogEventInfo eventinfo = new LogEventInfo(); ;
      eventinfo.Message = message;
      eventinfo.Level = priority;
      Log(eventinfo);
    }

static void Log(LogEventInfo logentry)
{     
  _logger.Log(logentry);
}
Run Code Online (Sandbox Code Playgroud)

formatting date nlog

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