locked
wcf service app.config file read error RRS feed

  • Question

  • User-1835425756 posted

    i have class library project where i add the app.config file and give this class lib. project reference (as dll) to the wcf service.

    when i add app.config in wcf and add key in it and then access in wcf via
    string messagepath = ConfigurationManager.AppSettings["MessagePath"].ToString();
    then my wcf is not working
    but when i pass hard coded path, it is working

    i got following error:
    Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service. 

    if i Add this:
    string messagepath = "D:\\Projects\\Messages"; 

    and Comment this:
    // string messagepath = ConfigurationManager.AppSettings["MessagePath"].ToString(); 

    The wcf service is working fine.

    Tuesday, July 23, 2013 1:58 AM

Answers

  • User-1835425756 posted

    it is resolved by applying the same key path into the web.config file of the WCF service.

    <appSettings>
    <add key="MessagePath" value="D:\Projects\Messages"/>
    </appSettings>

    Thx 

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 23, 2013 2:15 AM

All replies

  • User-1835425756 posted

    it is resolved by applying the same key path into the web.config file of the WCF service.

    <appSettings>
    <add key="MessagePath" value="D:\Projects\Messages"/>
    </appSettings>

    Thx 

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 23, 2013 2:15 AM
  • User260886948 posted

    Hi,

    I am very glad that you have solved your problem by yourself.

    If you have any other problem, welcome to post it in the asp.net forums.

    Best Regards, Amy Peng

    Monday, July 29, 2013 12:18 AM