Is there a way to do this at runtime?
A:
You could check and see if it's being hosted not on port 80 (since the dev server will by default give you a rather random port number)
TheTXI
2009-07-30 18:30:14
By default this might work, but you can have IIS run on any port you want in a pinch.
Wyatt Barnett
2009-07-30 20:31:46
+4
A:
The standard server variables associated with IIS (INSTANCE_ID
, INSTANCE_META_PATH
), and SERVER_SOFTWARE
all appear to be empty when examined from apps running on the ASP.NET Development Server. I would suggest examining their contents via Request.ServerVariables["SERVER_SOFTWARE"]
or similar.
Jason Musgrove
2009-07-30 18:34:17
A:
Since I always compile my code for "Release" to normal servers and "Debug" for local code building, I always take advantage of
#if DEBUG
//Some code that only happens in debug mode
#else
//Production code (frequently connection strings)
#endif
Of course, if you forget to switch to "Release" mode when you publish, it's bad news :)
JustLoren
2009-07-30 18:37:43
A:
If you are accessing it from a different machine it can't be the ASP.NET Development Server ("Casini")
Andrei Rinea
2009-08-03 06:28:48