Hey, Lex, that's great!
Gald to hear about that.
I've got one odd problem with WCF:
_____________________
Q When hosting ASMX classes in my own app, what happens to HttpContext.Current? What about SoapExtensions?
A Unfortunately, the ASMX design is tightly coupled with ASP.NET. For example, when Visual Studio® creates new ASMX classes, it derives them from System.Web.Services.WebService by default. This exposes the various System.Web.HttpContext properties through properties on the new ASMX class, thereby encouraging their use throughout WebMethods. Some developers are also accustomed to explicitly using the HTTP context via HttpContext.Current.
When you host an ASMX class using SoapReceivers in WSE 3.0, this type of code no longer works. In this case, your code is executing outside of IIS and the ASP.NET HTTP pipeline. HttpContext.Current will always be null, so this may require you to modify your existing WebMethod logic. In general, you'll want to avoid depending on anything in the HTTP pipeline throughout your WebMethod code if you plan to reuse that type across hosting environments outside of ASP.NET.
Also, when using SoapReceivers as a host, you can no longer depend on HttpModules or SoapExtensions to do the work for you. These intermediaries are no longer in play since you're now executing outside of the ASMX handler.
__________________
So, the following code in DataRepository.cs does not work anymore:
/// <summary>
/// Gets a reference to the application configuration object.
/// </summary>
public static Configuration Configuration
{
get
{
if ( _config == null )
{
// load specific config file
if ( HttpContext.Current != null )
{
_config = WebConfigurationManager.OpenWebConfiguration("~");
}
else
{
String configFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile.Replace(".config", "").Replace(".temp", "");
// check for design mode
if ( configFile.ToLower().Contains("devenv.exe") )
{
_config = GetDesignTimeConfig();
}
else
{
_config = ConfigurationManager.OpenExeConfiguration(configFile);
}
}
}
return _config;
}
}
______________
Any ideas how to fix this?