[英]Can you deploy single aspx.cs file using Visual Studio Web Publish to Azure Web App (Azure runtime issue)
I've noticed that although I'm able to successfully deploy my web app (ASP.NET) to Azure using web publish in Visual Studio.我注意到,虽然我能够使用 Visual Studio 中的 web 发布成功地将我的 web 应用程序 (ASP.NET) 部署到 Azure。 I'm also able to successfully deploy individual files to the server directory, by right clicking on the file in the solution explorer and clicking publish.通过右键单击解决方案资源管理器中的文件并单击发布,我还能够成功地将单个文件部署到服务器目录。
However, changes to the code behind don't seem to run on the server without publishing the entire solution.但是,如果不发布整个解决方案,对背后代码的更改似乎不会在服务器上运行。 Changes to the HTML/CSS etc are updated and become effective immediately, and the C# code is making it to the server successfully, but the server continues to run the previous code.对 HTML/CSS 等的更改会更新并立即生效,并且 C# 代码已成功发送到服务器,但服务器会继续运行之前的代码。
I have tried restarting the app in azure, and I've added the rules to prevent server caching.我尝试在 azure 中重新启动应用程序,并且添加了防止服务器缓存的规则。
Is there anything that a full web-publish does that the publishing of individual files doesn't do?有没有什么是完整的网络发布可以做的,而单个文件的发布则没有?
Changes to your code (.cs files) are compiled into a code library file.对代码(.cs 文件)的更改将编译到代码库文件中。 This file is saved into the bin folder and will be named like your project, for example yourprojectname.dll
.此文件保存在bin文件夹中,并将与您的项目一样命名,例如yourprojectname.dll
。 This is all done by Visual Studio.这一切都由 Visual Studio 完成。
For the changes in your code behind files to work, you need to publish the respective dll
files to your host.为了使您的代码隐藏文件中的更改起作用,您需要将相应的dll
文件发布到您的主机。
If you publish the project then the required dll
files will also be included, so your changes will work .如果您发布项目,那么所需的dll
文件也将包含在内,因此您的更改将起作用。
You don't really want to publish your cs files at all.您根本不想发布您的 cs 文件。 These are source code and aren't needed by the host server for your application to function.这些是源代码,主机服务器不需要您的应用程序运行。 cs files should be checked into your version control system (ie GitHub repository) cs文件应检入您的版本控制系统(即 GitHub 存储库)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.