i'm having problem when using custom assembly in reports. using microsoft sql server 2012 express edition reporting services , designing our reports in microsoft visual studio 2010
scenario: in reporting services want base language of report based on parameter. strings translated of web service has simple "translate" method. because cannot reference web service in report, used custom assembly accesses web service. after giving assembly correct permissions, placing .dll in correct places worked charm.
problem: when web service referenced in custom assembly app.config file generated system.servicemodel node seen below.
<system.servicemodel> <bindings> <basichttpbinding> <binding name="itranslatorservicebinding" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" allowcookies="false" bypassproxyonlocal="false" hostnamecomparisonmode="strongwildcard" maxbuffersize="65536" maxbufferpoolsize="524288" maxreceivedmessagesize="65536" messageencoding="text" textencoding="utf-8" transfermode="buffered" usedefaultwebproxy="true"> <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384" maxbytesperread="4096" maxnametablecharcount="16384" /> <security mode="none"> <transport clientcredentialtype="none" proxycredentialtype="none" realm="" /> <message clientcredentialtype="username" algorithmsuite="default" /> </security> </binding> </basichttpbinding> </bindings> <client> <endpoint address="webserviceaddress" binding="basichttpbinding" bindingconfiguration="translatorservicebinding" contract="translator.itranslatorservice" name="itranslatorserviceport" /> </client> </system.servicemodel> appearantly when dll used in application, dll's config file should @ location of application references it. because have no idea store particular config file when using reporting services decided add programmatically via following code:
var remoteaddress = new system.servicemodel.endpointaddress(yourwebserviceuri); using (var translateservice = new translator.translatorserviceclient(new system.servicemodel.basichttpbinding(), remoteaddress)) { translateservice.endpoint.binding.sendtimeout = new timespan(0, 0, 1, 0); return translatedstring = translateservice.translate(isocode, nativestring); } this enough assembly find web service , use it. however, can see, yourwebserviceuri hardcoded in assembly. want avoid this. decided add key in web.config file of reporting services this:
<appsettings> <add key="webserviceuri" value="yourwebserviceuri"/> </appsettings> however, if, reason want change settings in basichttpbinding i'd have add programmatically , rebuild assembly. avoid this, want know if copy&paste servicemodel somewhere in config file reporting services can recognize it.
question: config file need adjust in order custom assembly pick endpoint , manage connect web service?
you can assume have correct permissions set , dll in correct place. not know store app.config, or configuration file need alter.
in end web.config need alter system.servicemodel. it's important restart report server otherwise changes not take effect. problem fixed.
Comments
Post a Comment