Search
Resolved
as Fixed Help for as Fixed

1
Sign in to vote
0
Sign in to vote
Sign in
to vote
Type: Bug
ID: 491844
Opened: 9/24/2009 6:43:26 AM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
It seems when I enable the <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> setting in system.serviceModel and decorate my service with the AspNetCompatibilityRequirements attribute, something is not happening correctly in the IIS ASP.NET/WCF pipeline to set up HttpContext.Current and my ConfigurationManager correctly.

On the first hit (or after recyclying the application pool), HttpContext.Current is always null in my UserNamePasswordValidator. My web.config appSettings values are also not loaded from my path (~/service/test.svc contains a ~/service/web.config that contains the values I need).

On every subsequent hit, HttpContext.Current is valid and my (Web)ConfigurationManager.AppSettings contains the correct values from my ~/service/web.config as expected.

The two stack traces of trying to access HttpContext.Current from my validator are located at http://img12.imageshack.us/gal.php?g=capturezk.png which I also attached to this report.

See my post on http://stackoverflow.com/questions/1468924/inherited-web-config-files-and-httpcontext-bug-in-wcf as well, which may have some updates from other users as time goes on.

This is a pretty serious issue as we expect HttpContext.Current to be available. The AppSettings can be moved into the global web.config, but there is no workaround for the HttpContext issue.
Details (expand)

Product Version

.NET Framework 3.5 SP1
Product Language
English

Operating System
Windows 7 (client)
Operating System Language
English

Architecture
x64

Priority
(1=blocking, 2=important, 3=nice to have)
1

Severity
(1=major functionality issue, 2=important functionality issue, 3=nice to have)
1

Steps to Reproduce
Create a directory layout like such:

/
/web.config
/service
/service/test.svc
/service/web.config

Enable the ASP.NET compatibility mode for WCF. Insert some settings into your /service/web.config.

Try to access HttpContext.Current or (Web)ConfigurationManager.AppSettings for the settings you added to your /service/web.config
Actual Results
HttpContext.Current is null

Settings do not exist in the (Web)ConfigurationManager.AppSettings property.
Expected Results
HttpContext.Current should be the current HttpContext (as it is on every subsequent hit).

Settings should exist in (Web)ConfigurationManager.AppSettings (and they do on subsequent hits).
Component Usage
(any information on your scenario that may help in investigating your issue)
 

How often does this happen?
Always Happens

Have you seen this problem in other versions?
I don't know if this issue existed previously
File Attachments
2 attachments
Capture2.PNG
Capture.PNG
Sign in to post a comment.
Posted by Microsoft on 9/24/2009 at 9:23 PM
Thank you for your feedback, We are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com/)
Posted by Microsoft on 10/25/2009 at 3:20 PM
Thank you for reporting this issue. This issue has been fix in 4.0 of the .NET framework. Fix is present in the recently released Beta2 bits.