网站应该如何组织?
For example how this site is organized?
What i do not understand is what they upload to the Microsoft server?
I have created, with Visual studio, a very small web-page and i have to upload the whole site, even after the smallest change...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通常的方法是用 xcopy 或 Visual-studio 中的发布功能替换所有内容,在某些情况下替换所有内容是唯一的方法 - 例如,如果您使用 Web 应用程序项目模型,则所有内容都会打包到单个程序集中,并且就这样 - 即使应用一个小更改,您也必须重新部署整个系统。
另一种选择是 Visual Studio 中的网站模型,使用它您应该能够在服务器上部署单个代码文件,并且如果您从 IIS 管理工具重新启动网站,它们应该会被拾取。事实上,与 Web 应用程序项目模型相比,该模型的工作方式不同。它只是一堆由 ASP.NET 运行时动态编译的代码文件。
即使可能,我也不建议部署单个文件的方法,因为这很容易出错(您部署了代码隐藏,并且很容易忘记部署 aspx 对应项或类似文件)。除非您要通过慢速网络部署大量内容,否则重新部署整个内容始终是最安全的选择。
看看这个和这个有趣的链接来找出答案有关 Visual Studio 中的网站和 Web 应用程序项目模型的更多信息。
The usual approach is to replace everything with xcopy or the publish function in visual-studio, and in some cases replacing everything is the only approach - for example if you're using the web-application project model everything gets packaged into a single assembly and there you go - even to apply a small change you'll have to re-deploy the whole thing.
An alternative to this could be the Website model in visual studio, using which you should be able to deploy single code files on your server and they should be picked-up if you re-start the website from the IIS management tool. This model - in fact - works in a different way compared to the web-application project model. It's just a bunch of code files that will be dynamically compiled by the ASP.NET runtime.
Even if possible though - I wouldn't suggest the approach of deploying single files - as this is easily error prone (you deploy the code-behind and could easily forget to deploy the aspx counterpart, or similar). Unless you're delpoying Gigs of stuff over slow-networks, redeploying the whole thing is always the safest bet.
Have a look at this and this interesting links to find out more about website and web-application project models in visual studio.
这实际上在很大程度上取决于您构建应用程序的方式。
如果您在 VS 中创建一个 ASP.Net 站点,那么您可以将其作为网站项目,或者作为 Web 应用程序项目。
在前一种情况下,您的文件将保留为 aspx 和 .aspx.cs 文件,并且您可以复制(或 FTP)任何文件发生的更改。如果您想要超出单个页面范围的逻辑,您可以创建一个单独的类库项目,或者使用 App_code 目录。
在后一种情况下,您将把所有逻辑编译到一个或多个 .dll 文件中,这些文件将复制到站点的 /bin 目录,以及任意数量的 aspx 文件,这些文件可以保留原样或嵌入(建议将它们保留为 aspx)文件)。同样,如果一个 aspx 文件发生变化,您只需移动发生变化的文件,如果 dll 中的任何内容发生变化,您将替换整个 dll。
话虽如此,您发布的网站上的大部分内容可能已从数据库中删除。现在,大多数站点在页面上没有内容,它们只是在页面上具有组织(视图)逻辑,并且具有从数据库中获取实际内容以提供服务的其他类。这允许更大程度的重用,并且意味着 MSDN 上的 4,000 个页面(随机选择的数量)不必单独编码为 HTML 页面。
It really depends a lot on how you're building your app.
If you're in VS and you're doing an ASP.Net site, then you can either do it as a Website Project, or as a Web Application project.
in the former case, your files will remain as aspx and .aspx.cs files and you xcopy (or FTP) whichever files change. if you want logic that's outside the scope of a single page, you'll either create a separate class library project or else use the App_code directory.
In the latter case, you'll compile all the logic into one or more .dll files that get copied to your site's /bin directory, and any number of aspx files that can either stay as such or be embedded (recommend leaving them as aspx files). Again, if an aspx file changes, you just movethe one that changed, if anything in the dll changes, you replace a whole dll.
All that said, a huge chunk of what's on the site you posted is probably being pulled out of the database. Most sites now dont' have content on pages, they just have organizational (view) logic on paes, and have other classes which fetch the actual content out of a database to serve up. This allows greater reuse and means that the 4,000 pages (number chosen at random) on MSDN don't have to be each coded individually as an HTML page.
谷歌搜索后,我认为,在 Visual Studio 的发布网站表单中使用固定命名和单页程序集复选框是正确的选择。
虽然这可能会减慢速度......
After Googling i think, the check-box Use fixed naming and single page assemblies in the publish Website form of the Visual studio, is the right choice.
Although it might slow things down...