2016-11-04 17 views
0

Я создал приложение API Azure Web, которое использует собственные 64-разрядные библиотеки DLL. Я могу запустить службу локально без каких-либо проблем. Однако, когда я пытаюсь разместить его на Azure, я получаю следующую ошибку.Ссылка на собственную 64-битную dll в Azure Web Api App

Существует thread с известной проблемой по загрузке собственных DLL внутри приложений Azure. Я выполнил это решение и создал сценарий XDT для добавления папки bin (D: \ home \ site \ wwwroot \ bin) в PATH. К сожалению, это не помогло.

Я проверял, что мои dll находятся в папке bin приложения, используя консоль Azure Portal. Я также подтвердил в Kudu, что мое приложение видит обновленный путь. Я убедился, что настройки приложения внутри Azure Portal установлены на 64 бит. Если я установил параметры приложения обратно в 32-битный режим, он найдет dll и вместо этого выдает неверную ошибку формата, поэтому кажется, что есть некоторая проблема, связанная с внутренними 64-битными DLL внутри Azure.

Я получаю следующее сообщение об ошибке, когда я пытаюсь вызвать мое приложение:

Server Error in '/' Application. 

    Could not load file or assembly 'My64Bit.DLL' or one of its dependencies. The specified module could not be found. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'My64Bit.DLL' or one of its dependencies. The specified module could not be found. 

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Stack Trace: 


    [FileNotFoundException: Could not load file or assembly 'My64Bit.DLL' or one of its dependencies. The specified module could not be found.] 
     System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 
     System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +234 
     System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +108 
     System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +25 
     System.Reflection.Assembly.Load(String assemblyString) +34 
     System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +49 

    [ConfigurationErrorsException: Could not load file or assembly 'My64Bit.DLL' or one of its dependencies. The specified module could not be found.] 
     System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +772 
     System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +259 
     System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +163 
     System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +230 
     System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +76 
     System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +343 
     System.Web.Compilation.BuildManager.ExecutePreAppStart() +176 
     System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +734 

    [HttpException (0x80004005): Could not load file or assembly 'My64Bit.DLL' or one of its dependencies. The specified module could not be found.] 
     System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +539 
     System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +125 
     System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +731 

ответ

1

Вопрос был, что я собрал библиотеку DLL, как Debug и не отпускаю, рассеяв их ссылки VCRUNTIME [...] D и MSVCP [...] D отлаживать библиотеки DLL, которые недоступны в Azure. Повторная компиляция DLL в Release решила проблему.