开发者

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

开发者 https://www.devze.com 2022-12-22 19:18 出处:网络
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

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.


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.


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>
0

上一篇:

:下一篇

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号