0

I am using Aspnet webapi2. I want to register a message handler based on the environment. can you please let me know how can i configure the same based on environment.

 public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {

            if (Env.Equals("Live"))
            {
                config.MessageHandlers.Add(new NotAcceptableConnegHandler());
            }
}
}
3
  • I tried this by adding a key in config and retrieving the same. not sure though if its best practice. Commented Oct 19, 2018 at 8:34
  • Can you put your code here? It is difficult to say without code. Commented Oct 19, 2018 at 16:06
  • i need to update my if condition. Commented Oct 21, 2018 at 5:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.