Josh
Josh

Reputation: 13818

<serviceHostingEnvironment> through C# code in WCF

How do I set serviceHostingEnvironment=true through c# code? It seems to be readonly.

Please advice.. Thank you..

Upvotes: 1

Views: 2125

Answers (2)

DaveRead
DaveRead

Reputation: 3413

Which property of ServiceHostingEnvironment do you want to set?

The class itself is marked as public static, so you can't "set" it, only use the properties it exposes.

http://msdn.microsoft.com/en-us/library/system.servicemodel.servicehostingenvironment.aspx

Possible duplicate of this question: How to set ServiceHostingEnvironment.AspNetCompatibilityEnabled = true in Code (not in config) .NET/C#

Upvotes: 2

mellamokb
mellamokb

Reputation: 56769

<serviceHostingEnvironment> is not a property, it's a tag containing properties. You need to set the relevant property instead, i.e., ServiceHostingEnvironment.ASPNetCompatibilityEnabled.

Upvotes: 0

Related Questions