How can I determine if I am running locally on my PC or on the cloud?

前端 未结 4 2015
你的背包
你的背包 2020-12-31 08:37

Using MVC3 and I\'d like to determine if I am running locally or deployed to the cloud?

4条回答
  •  时光说笑
    2020-12-31 08:50

    You can do it the old-fashioned way, by looking for the existence of an Environment Variable.

    Set the value of your environment variable in computer properties and read it using Environment.GetEnvironmentVariable("MyVariable").

    On Azure, the variable won't be present, so the call will return null.

提交回复
热议问题