Pages

Thursday, April 21, 2011

Title: exePath must be specified when not running inside a stand alone exe - known causes?

knowlton : - "exePath must be specified when not running inside a stand alone exe" .
What are some known causes / solutions for this error?

IIS / ASP.NET / C#


Rovastar : - Incorrectly using ConfigurationManager.OpenExeConfiguration instead of the correct ConfigurationManager.OpenWebConfiguration when using web applications is a common cause.

pcsmitpra : - There is first possible cause that you are referring to configuration group like here:
we can use ConfigurationManager.OpenWebConfiguration() method instead of ConfigurationManager.OpenExeConfiguration().

There is one more close and relevant case :
API configuration for WCF :
Configuration appConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ServiceModelSectionGroup serviceModel = ServiceModelSectionGroup.GetSectionGroup(appConfig);
This code will work while the application is an exe but if you will write the same code in an web application it will fail.

Here the issue is , IIS could not load the exe from configuration manager, So we require configuration section instead of Configuration group to use directly ConfigurationManager and some modified syntax. The previous example can now be rewritten like this:
ClientSection client = ConfigurationManager.GetSection("system.serviceModel/client") as ClientSection;

I hope it will give you a good idea to deal with it.
Cheers.
 

1 comment:

  1. hey this site background is same as http://www.lyricsintelugu.com
    copyyyyyy

    ReplyDelete