Why won’t my windows service write to my log file?

I’ve had this issue too. As mentioned by genki you are probably logging into the \Windows\System32 directory. Maybe check for the log file you are expecting there first. When writing services I’ve often put a line like this in the beginning to get the current directory to behave like a normal application Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);

access HttpContext.Current from WCF Web Service

You can get access to HttpContext.Current by enabling AspNetCompatibility, preferably via configuration: <configuration> <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled=”true”/> </system.serviceModel> </configuration> That in turn allows you to get access to the current user: HttpContext.Current.User – which is what you’re after, right? You can even enforce AspNetCompatibility by decorating your service class with an additional attribute: [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] … Read more

How to dynamically inject a service using a runtime “qualifier” variable?

You can obtain your bean from the context by name dynamically using a BeanFactory: @Service public class Doer { @Autowired BeanFactory beans; public void doSomething(Case case){ CaseService service = beans.getBean(case.getCountryCode(), CaseService.class) service.doSomething(case); } } A side note. Using something like country code as bean name looks a bit odd. Add at least some prefix or … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)