iis - WCF services couldn't read configuration file -


i have created wcf services in class library. these services need configuration values work properly. added these configurations web.config file after deploying services on iis. problem when try consume these services following exception while reading configurations:

system.argumentexception: exepath must specified when not running inside stand alone exe.

knowing when test services works fine before hosting them on iis.

the question should change make dll services able configured.

here portion of web.config file.

    <children>   <child name="service_config">     <properties>       <property name="connection_name" value="photo" valuetype="system.string" />       <property name="data_access_interface" value="data_access" valuetype="system.string" />       <property name="is_client_db" value="false" valuetype="system.string" />       <property name="exchange_service" value="exchange_service_key" valuetype="system.string" />       <property name="max_file_size" value="1000" valuetype="system.string" />       <property name="email_sender" value="test@gmail.com" valuetype="system.string" />       <property name="email_body_template_name" value="test_files/template.txt" valuetype="system.string" />       <property name="tablet_photo_size_height" value="100" valuetype="system.string" />       <property name="tablet_photo_size_width" value="90" valuetype="system.string" />       <property name="phone_photo_size_height" value="200" valuetype="system.string" />       <property name="phone_photo_size_width" value="180" valuetype="system.string" />       <property name="phone_photo_optimized_size_height" value="80" valuetype="system.string" />       <property name="phone_photo_optimized_size_width" value="60" valuetype="system.string" />       <property name="web_photo_size_height" value="127" valuetype="system.string" />       <property name="web_photo_size_width" value="170" valuetype="system.string" />       <property name="email_client_key" value="email_client_key" valuetype="system.string" />     </properties> 

it's not entirely clear you're trying do, sounds you're using configurationmanager.openexeconfiguration read specified section(s) of config file. error message received gives starting point figuring out issue - iis not having path exe.

you don't show code you're using config file, , posted configuration doesn't have lot of context, it's hard tell do.

however, use <appsettings> section of config file (available in both app.config , web.config files) store these properties, , retrieve them configurationmanager.appsetting[keyname].

something this:

<appsettings>   <add key="connection_name" value="photo" />   <add key="data_access_interface" value=data_access" />   <!-- plus rest of values --> </appsettings> 

then you'd use like:

string connectionname = configurationmanager.appsettings["connection_name"]; string dataaccesinterface = configurationmanager.appsettings["data_access_interface"]; 

this work whether you're running stand alone exe or hosting in iis.

if there's reason don't want (or can't) use standard <appsettings> section, please update question context around <children> section plus how you're trying access can provide better guidance.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -