开发者

Application_Start not behaving correctly in ASP.Net 4.0 Application

开发者 https://www.devze.com 2023-03-13 12:42 出处:网络
I\'m stumped. I ran t开发者_StackOverflow社区hrough all the recommendations on StackOverflow and Google... no joy.

I'm stumped. I ran t开发者_StackOverflow社区hrough all the recommendations on StackOverflow and Google... no joy.

My Application_Start method is not behaving correctly in my ASP.Net 4.0 application. I can set Application variables, but not call my logging method.

I can set variables:

Application["appStartDT"] = DateTime.Now.ToString();

But my logging method is not called:

Utilities.writeLog("Application started at: " + System.DateTime.Now.ToString(), 4);

This happened about the time I switched from the internal IIS server in VWDE 2010 to IIS 7.5 (On Windows 7), though I'm not 100% it's related (had to switch, as I was using virtual directories).

[Post Script Edit: I switched to project back to "Use Visual Studio Development Server" and my Application_Start method fired and executed my logging method. I need to use IIS. Any suggestion on what IIS setting I am overlooking?]

Any suggestions would be helpful.

Respectfully,

Ray


I think one difference with switching to IIS is that the IIS process that your website is running under will now be the [local machine]\Network Service account. I am assuming that your Utilities.writeLog method is writing something out to a file. If that in fact is the case, then you should check that the Network Service account has read/write privileges to the file and folder where you are logging. I have experienced this same issue with log4Net logging output to a file and when I gave the Network Service account access to the folder/file I was logging to, the issue went away.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号