DevMania
DevMania

Reputation: 2341

wcf multiple end point address on Dev and Prodcution server how to?

after digging for a while i have decided to go with WCF service and i really love the idea of multiple end points, this will let me serve different type of service protocols with one service.

now my question is how i can make for example a service address like this

http://www.mysite/services/blog/RSS/gettopposts

http://www.mysite/services/blog/JSON/gettopposts

to be more specific i want to be able to test this address both on Dev and production server without changing configuration

one more question will this help me in security as i would want my real WCF file location to be under ~/Internal/Services/blog.svc

thanks alot in advanced.

Upvotes: 1

Views: 337

Answers (2)

noonand
noonand

Reputation: 2865

Are you using VS2010? You don't specify If you are please investigate web.config transformation at http://go.microsoft.com/fwlink/?LinkId=125889

In the example below (directly from the help), the "SetAttributes" transform will change the value of "connectionString" to use "ReleaseSQLServer" only when the "Match" locator finds an atrribute "name" that has a value of "MyDB".

<connectionStrings>
   <add name="MyDB" connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>

Upvotes: 0

wallismark
wallismark

Reputation: 1856

Are you asking how to configure WCF for multiple environments?

If you are my posting on msbuild and multiple environments may help.

What we do is store the url's in an SQL Compact database (could also simply be in the config file), we store the environment specific url's in a separate xml file then as part of the build process the urls are updated in the SQL db.

Then to point to any given 'environment' we just have to change the 'BuildEnvironment' setting and all urls for the WCF services (and other environment specific info) are automatically set to their correct values.

Upvotes: 1

Related Questions