I have an word add in application created in c# which is accessing a web service and is perfectly working if installed outside Program Files folder. the weird thing is that when I install this in Program Files folder, the client is failing to read the config in [application].dll.config and raising an error like below:
"Could not find default endpoint element the references contract [..] in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."
I have read this article and it seems that it doesn't solve my problem. Could not find default endpoint element
Im using windows7 btw and haven't tested to other OS.
Update: After reading the above link, I've tried to move the configuration to machine.config and it works, but how do I make my application read the application config instead of machine.config?
Add the App. config file to your project. After creating a . NET Framework project, right-click on your project in Solution Explorer and choose Add > New Item. Choose the Application Configuration File item and then select Add.
config ? The web. config files specify configuration settings for a particular web application, and are located in the application's root directory; the machine. config file specifies configuration settings for all of the websites on the web server, and is located in $WINDOWSDIR$\Microsoft.Net\Framework\Version\Config.
You can have a web. config for each folder under your web application. app. config is used for windows applications.
By default, the name of the configuration file is App. config. To create the output configuration file that's deployed with the app, Visual Studio copies the source configuration file to the directory where the compiled assembly is placed. This file is named <yourappname>.exe.
If you are using VSTO 4 SP1, then you may be running into a problem described in this blog: http://msdnrss.thecoderblogs.com/2011/06/vsto-4-0-sp1-will-cause-a-vsto-addin-to-not-find-its-config-file/ The solution is to change your registry values for your office addin from:
Manifest=”C:\Program Files\<Path>\WordAddIn.vsto|vstolocal”
to:
Manifest=”file:///C:\Program Files\<Path>\WordAddIn.vsto|vstolocal“
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With