locked
Will ASP.NET look in WinSxS for C runtime dependencies? RRS feed

  • Question

  • User203552936 posted

    I am having an issue loading a managed C++ assembly with unmanaged C (native) dependencies.

    My question is whether ASP.NET / IIS will attempt to resolve the C/C++ runtime from WinSxS?

    If yes, what is the search order?

    The shadow copy will ensure that we are working from one of the temporary asp.net folders in e.g. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\... but I am not sure when the WinSxS is scanned (or if it is scanned at all).

    Can this be disabled?

    Details

    My ASP.NET (MVC 4) app is referencing a managed C++ assembly called managed.dll. This assembly is referencing CRT (C/C++ runtime) using:

    • msvcr80.dll (only one showed in Dependency Walker)
    • msvcp80.dll
    • msvcm80.dll

    However, the same assembly has another dependency to a C native dll, which also has a dependency to the C runtime (again shown as msvcr80.dll in Dependency Walker). Apparently IIS will not resolve that correctly, even though it works out of the box in a console app.

    Using dependency walker I can see the two references - showing full paths. reveals that they are picked up from different locations. One is a local file in the bin folder, the other is the one from WinSxS.

    I have tried modifying the Microsoft.CRT.manifest file to remove publicKeyToken and hash values, but that did not have any effect.

    My theory is that if I can get Dependency Walker to pick up the same file (e.g. by using manifest files or similar), I can get it to work in ASP.NET too.

    Friday, July 5, 2013 4:42 AM

Answers

  • User-166373564 posted

    Hi,

    but I am not sure when the WinSxS is scanned (or if it is scanned at all).

    For this issue, I think you could learn that from what the the WinSxS is and the mechanism of WinSxS,

    Side-by-side technology is also known as WinSxS or SxS, although technically WinSxS refers only to the global side-by-side store (officially called the "Windows component store"), which is conceptually the native equivalent of the .NET Global Assembly Cache. Executables that include an SxS manifest are designated SxS assemblies.

    And Operating system files in the WinSxS directory are hard linked to their usual locations in the Windows directory structure. The same file may be linked from a directory in WinSxS and from, say, the System32 directory,

    # Side-by-side assembly - http://en.wikipedia.org/wiki/Side-by-side_assembly#WinSxS 

    At the same time you can also learn how to build C/C++ isolated applications and Side-by-side assemblies, it will be helpful for us to understand it better,

    # Building C/C++ Isolated Applications and Side-by-side Assemblies

    http://msdn.microsoft.com/en-us/library/ms235532.aspx 

    hope it helps you,

    Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 11, 2013 10:31 PM

All replies

  • User-166373564 posted

    Hi,

    but I am not sure when the WinSxS is scanned (or if it is scanned at all).

    For this issue, I think you could learn that from what the the WinSxS is and the mechanism of WinSxS,

    Side-by-side technology is also known as WinSxS or SxS, although technically WinSxS refers only to the global side-by-side store (officially called the "Windows component store"), which is conceptually the native equivalent of the .NET Global Assembly Cache. Executables that include an SxS manifest are designated SxS assemblies.

    And Operating system files in the WinSxS directory are hard linked to their usual locations in the Windows directory structure. The same file may be linked from a directory in WinSxS and from, say, the System32 directory,

    # Side-by-side assembly - http://en.wikipedia.org/wiki/Side-by-side_assembly#WinSxS 

    At the same time you can also learn how to build C/C++ isolated applications and Side-by-side assemblies, it will be helpful for us to understand it better,

    # Building C/C++ Isolated Applications and Side-by-side Assemblies

    http://msdn.microsoft.com/en-us/library/ms235532.aspx 

    hope it helps you,

    Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, July 11, 2013 10:31 PM
  • User203552936 posted

    Thanks for the info.

    I have looked into the links provided, but I am still failing to figure out the difference between resolving dependencies in IIS and outside IIS. There is clearly a difference.

    Working with 3rd party dependencies seems to be a hassle too - since I don't have the possibility to just flick some settings on the dependencies and recompile them.

    No solution has been found yet (besides the work around), but the task is shelved right now, and I pick it up once in a while to take a new look at it.

    Monday, July 15, 2013 5:19 AM