web config - WCF Web API Configuration File to IIS -
web config - WCF Web API Configuration File to IIS -
i have implemented restful service wcf web api , want publish in iis. during developing process using service console application , configuration made through api. i'm trying publish service asp.net application , way see somehow move configuration web config file.
here coded configuration:
var cfg = httphostconfiguration.create() .addmessagehandlers(typeof(allowcrossdomainrequesthandler)); using (var host = new httpconfigurableservicehost(typeof(restfulservice), cfg , new uri("http://localhost:8081"))) { var endpoint = ((httpendpoint)host.description.endpoints[0]); //assuming 1 endpoint endpoint.transfermode = transfermode.streamed; endpoint.maxreceivedmessagesize = 1024 * 1024 * 10; // allow files 10mb host.open(); console.writeline("host opened @ {0} , press key end", host.description.endpoints[0].address); console.readkey(); } how should web.config reflect configuration? or there other approach instead of using asp.net?
any help appreciated.
if want preserve existing config, can set config set stuff method, , phone call global.asax application_start() method. global.asax methods called in wcf same asp.net.
or, can wire services custom servicehostfactory , servicehost has configuration in (this approach using in current app).
web-config wcf-web-api
Comments
Post a Comment