Host name resolution from Excel add-in RRS feed

  • Question

  • Hello there,

    We've built Excel add-in on .Net framework 3.5 that utilizes remote API for data processing.
    Everything seems works as expected however one of our corporate customers has reported that our add-in doesn't work within their corporate network.
    I asked this question in common .Net forum and they suggested to build a test application that utilizes the same API and check it on customer's machine.
    I did it and realized that application works fine there.

    I performed necessary configuration in application configuration file like shown below.
    This configuration allows console application reaching external resources but doesn't work for our Excel add-in.

    <?xml version="1.0" encoding="utf-8" ?>
        <defaultProxy useDefaultCredentials="true">
          <proxy proxyaddress=""></proxy>

    Can someone point me into a right direction, please?
    The original thread from common .Net board is

    Thanks in advance,
    Friday, June 7, 2013 1:25 PM


All replies

  • Hi George,

    Thank you for posting in the MSDN Forum.

    Generally, if the configuration can work for console application, it should work for Excel Add-in as well since the configuration has nothing VSTO specific.

    I'll try to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Best regards,

    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, June 11, 2013 12:12 PM
  • Hi George,

    For the app.config file, how did you specify the config file for Excel add-in? Since excel add-in is loaded as part of excel application process, you will need to add .exe.config file for the excel program. Or you can take a look at the following thread which mentioned specifying app.config file for excel add-in's AppDomain:

    #Problem with excel add-in and app.config

    In addition, in .NET code, we can programmtically specify a WebProxy instance via WebRequest.DefaultWebProxy static property (which represents the global network proxy for current .NET application):

    #WebRequest.DefaultWebProxy Property

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, June 12, 2013 7:14 AM
  • Hi Quist,

    Thanks for your reply, I appreciate any help from your side.
    You're right, so far there shouldn't be any difference between console .Net application and Excel add-in but unfortunately it is. 
    I noticed that sample console application is capable to resolve DNS name through the host file and use proxy configured in application configuration file.

    In turn the customer has very strict environment that prevents accessing of any external resources directly so they use NAT and proxy for security reasons.
    Proxy seems clear, I was able to configure it as shown in previous post. IP translating is done through the host file.
    So they added specific record to the host file that transfers some domain to their NAT and then NAT transfers request to the remote resource.

    I thought that the problem is in this IPs translation but my console app is capable to access remote API even through that scheme so I inclined to think that the problem is in Excel add-in.
    Maybe it's related to permissions? Do we need to run add-in using administrative permissions? I don't think so but just think aloud...

    Please let me know if you need any other information related to that problem and I will give it to you.
    I'm looking forward for your answers.

    Thanks in advance,
    Wednesday, June 12, 2013 9:01 AM
  • Hi Steven,

    Thanks for your reply.

    Add-in configuration works well if I use configuration for DLL file instead of Excel executable file. 
    As you know add-in is built as simple managed DLL library so I created config file for the DLL file like shown below:

       - MyCompany.ExcelAddIn.dll
       - MyComapny.ExcelAddIn.dll.config

    I'm sure that add-in configuration works in such way, because if I make some changes to this file add-in react on them accordingly.


    Wednesday, June 12, 2013 1:28 PM
  • Thursday, June 13, 2013 3:08 PM
  • Hi Damian,

    Thanks for suggestion.

    However setting of proxy through the code isn't a way out.
    We offer Excel add-in for everyone and most of the users don't need any proxy configuration.
    Having of simple configuration file that can be adjusted on demand is ultimate goal.

    Moreover I don't think that the problem is in proxy settings. I believe it's in domain name resolution.
    It seems Excel add-in can't resolve name added to the host file due to some reasons.

    Can someone explain me what is the difference between having of configuration file for add-in DLL and Excel executable file?

    Thanks in advance,
    Thursday, June 13, 2013 3:56 PM
  • try to read proxy configuration from your config file yourself and set it in code using class mentioned in my previous post. Or if you want, print value in start class from add-in to log or message box to actually see if it got pick up by .net itself. as for troubleshooting it on client pc where it does not work - try using fiddler.
    Friday, June 14, 2013 3:44 AM
  • So, adding of config file for Excel executable file doesn't work at all.
    I didn't get what is the reason to do that but it doesn't work. Excel is native application so I don't think it will take into account managed configuration file.
    Setting of proxy settings through the code... Another possible solution Recommended by DamianD.
    Maybe it will work, but to be honest I'm not sure. What is the difference between setting proxy configuration through the code and using config file? Do you really think there will be a difference?

    Friday, June 14, 2013 1:11 PM
  • try it for yourself.
    Friday, June 14, 2013 1:42 PM
  • Hello George,

    Have you tried creating adding the same information to excel.exe.config file and placing the file in the folder

    "C:\Program Files (x86)\Microsoft Office\Office14\"



    Wednesday, July 31, 2013 9:28 PM