发布到Azure应用服务后无法加载文件或程序集 [英] Could not load file or assembly after publishing to Azure app service

查看:71
本文介绍了发布到Azure应用服务后无法加载文件或程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行我的应用程序时突然看到此错误(发布在Azure应用程序服务上:

I am suddenly seeing this error when running my app (published on Azure app service:

无法加载文件或程序集"Microsoft.SharePoint.Client,版本= 16.0.0.0,Culture =中性,PublicKeyToken = 71e9bce111e9429c"或其依赖项之一.该系统找不到指定的文件.在SharePointLibrary.SPClient.GetAllUsers()在C:\ Users \ bassie \ source \ repos \ TFS \ ADVWKSP \ ADVWKSP \ Managers \ UserManager.cs:line 21

Could not load file or assembly 'Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. at SharePointLibrary.SPClient.GetAllUsers() at ADVWKSP.Managers.UserManager.GetUsers() in C:\Users\bassie\source\repos\TFS\ADVWKSP\ADVWKSP\Managers\UserManager.cs:line 21

它在我的计算机上运行正常,并且在发布后曾经运行良好,但现在突然突然开始丢失该文件.

It runs fine on my machine, and it used to run fine after publish but now it just suddenly starts crying about this file missing.

我在Kudu中签到,但只能看到 SharePoint.Client.Runtime :

I checked in Kudu and I can only see the SharePoint.Client.Runtime:

为什么?如何确保所有必需的库都随项目一起发布.为什么这突然停止工作?

Why? How can I ensure that all required libraries are published with the project. Why did this suddenly stop working?

推荐答案

Azure Web应用程序的托管环境包含从 .Net framework 2.0 .Net framework 4.5的标准安装.

The hosting environment of azure web app contains a standard installation of .Net framework 2.0 to .Net framework 4.5.

如果您的应用程序引用了不在.Net框架中构建的程序集,则必须将其包含在您的部署包中.甚至这些都是Microsoft程序集.

If your application referenced assemblies which is not build in .Net framework, you have to "include" them with your deploy package. Even these are Microsoft assemblies.

将引用的程序集的复制本地属性设置为True 可能会解决该问题.

Setting the Copy Local property to True for the referenced assembly may fix it.

1.在解决方案资源管理器中,找到您的项目对库的引用.

1.In Solution Explorer find your project's reference to the library.

2.右键单击并选择属性".

2.Right click and choose Properties.

3.在属性"窗口中,将本地复制"设置为True.

3.In the Properties window set Copy Local to True.

正如您所说,它可以在IIS Express上本地运行,请尝试将您的网站内容手动部署到Azure

As you said, it works locally on IIS Express, please try to deploy your website content manually to Azure via KUDU or FTP client and find out whether it works or not.

这篇关于发布到Azure应用服务后无法加载文件或程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆