Using MIP SDK DLLs in IIS applications

To use MIP SDK in solutions hosted by an IIS, you'll have to take additional steps.

These are the the known issues:

Unmanaged DLLs in IIS applications not found

While the DLLs in the MilestoneSystems.VideoOS.Platform.SDK NuGet package are mostly managed DLLs, some managed MIP SDK DLLs depend on unmanaged DLLs. These unmanaged DLLs are optimized to handle video and ensure high performance.

Unfortunately, unmanaged DLLs are not loaded in an IIS application unless they're in a lookup path or loaded explicitly. When the application pools of your IIS start, for each application, the IIS copies managed DLLs to a temporary folder and starts executing the applications. If an IIS application depends on DLLs from the MilestoneSystems.VideoOS.Platform.SDK package, the application will fail since it can't find and load the unmanaged DLLs.

The easiest workaround for this is to add an entry to the system environment path. The entry must be the path of the folder that contains the unmanaged DLLs. Usually, this is the IIS application's bin folder.

To apply the workaround:

  1. Open the start menu and begin typing "Environment variables".

  2. Select Edit the system environment variables.

  3. The System Properties control panel opens. Select Environment Variables....

  4. The Environment Variables dialog opens. The lower part is a list of system variables (that is, used by all processes).

  5. Find the system environment variable "Path", select it, and select Edit....

  6. The Edit environment variable dialog opens. Select New and enter the path for the folder with MIP SDK DLL files. For example, this could be C:\inetpub\TestSite\bin.

  7. Restart the IIS.

    Note: IIS Express in Visual Studio has the same issue. The fix is the same, except that you must restart Visual Studio instead of restarting the IIS.

Could not load file or assembly 'System.Net.Http.Formatting'

This problem occurs when the application is unable to find a specific version of the DLL System.Net.Http.Formatting. You'll see a message similar to this:

Could not load file or assembly 'System.Net.Http.Formatting'

To resolve this, add an assembly binding redirect in the IIS application's web.config:

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly>

The binding redirect ensures that a reference to version 5.2.6.0 will use version 5.2.7.0 (the current version of System.Net.Http.Formatting).