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

"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#
LVL 5
Tom KnowltonWeb developerAsked:
Who is Participating?
 
pcsmitpraCommented:
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.
0
 
RovastarCommented:
Incorrectly using ConfigurationManager.OpenExeConfiguration instead of the correct ConfigurationManager.OpenWebConfiguration when using web applications is a common cause.
0
 
Tom KnowltonWeb developerAuthor Commented:
thx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.