Azure的ASP.NET MVC的Web.Config部署问题 [英] Azure ASP.NET MVC Web.Config Deployment Issue

查看:200
本文介绍了Azure的ASP.NET MVC的Web.Config部署问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发将在Windows Azure上托管的一个ASP.NET MVC的Web应用程序。我们已经部署了应用程序的开发过程中几次没有任何问题。它实际上是相当令人吃惊的过程是如何顺利去了。然后,当我们去部署beta测试应用程序,我们一直得到403拒绝访问错误,每当我们试图导航到该网站的基本URL。如果我们试图导航到任何的各种控制器和操作现场的以后,我们会得到404的资源无法被发现的错误。

We are developing an ASP.NET MVC web app that will be hosted on Windows Azure. We have deployed the application a few times during development without any problems. It was actually quite surprising how smooth the process went. Then, when we went to deploy the app for beta testing we kept getting 403 Access Denied errors whenever we tried to navigate to the base url of the site. If we tried to navigate to any of the various Controllers and Actions of the site thereafter we would get 404 The resource could not be found errors.

这是我们注意到另一个奇怪的是,我们已经定义的验证重定向页面是/门禁/签到,而不是默认的帐号/登录。一切正常的开发机器上,我们被重定向到/门禁/签到,但发布天青,当我们看到我们被重定向到/帐号/登录。这使我们认为有一个与web.config文件中的一个问题。

The other strange thing that we noticed is that we had defined the authentication redirect page to be /Access/SignIn rather than the default Account/Login. Everything worked fine on the development machine and we were redirected to /Access/SignIn but when publishing to Azure we saw we were being redirected to /Account/Login. This made us think there was an issue with the web.config file.

我们启用了Azure的部署远程桌面,并在web.config文件接过来一看才发现,这是几乎完全空的!在那里唯一的设置是的machineKey。我们手动复制从我们的开发机器到Azure的虚拟机实例,一切之一的web.config开始从那里工作。

We enabled remote desktop on the Azure deployment and took a look at the web.config file only to find out that it was almost completely empty! The only setting in there was the machineKey. We manually copied the web.config from one of our development machines up to the Azure virtual machine instance and everything started to work from there on.

在世界上是什么让部署全歼的web.config文件?而我们怎能prevent这种情况的发生,因为我们不打算能够更新web.config文件手动每次我们部署更新?

What in the world would make the deployment wipe out the web.config file? And how can we prevent this from happening as we aren't going to be able to update the web.config file manually every time we deploy an update?

推荐答案

我经常看.cspkg文件的内容解决这些各种各样的问题。这使我避免等待Azure的打包上传和初始化。以下是查看.cspkg内容的步骤:

I often solve these sorts of problems by looking at the contents of the .cspkg file. This allows me to avoid waiting for the Azure package upload and initialization. Here are the steps to view the .cspkg contents:


  1. 导航到/bin//app.publish文件夹

  2. 重命名.cspkg文件.cspkg.zip。

  3. 开启.cspkg.zip。你会发现在Azure项目引用的每个项目.cssx文件(这实在是一个zip文件)。

  4. 您解压缩至极检查,并改名为.cssx.zip的.cssx文件

  5. 打开.cssx.zip走一走,看一看。对于WorkerRoles,检查出为approot文件夹。对于WebRoles,检查出sitesroot文件夹中。

这篇关于Azure的ASP.NET MVC的Web.Config部署问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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