带有 IIS 的 ASP.NET 与带有 Apache 的 PHP

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/991378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 17:45:58  来源:igfitidea点击:

ASP.NET with IIS VS PHP with Apache

phpasp.netvisual-studioapacheiis

提问by DOK

I am going to develop a web portal. I have an option to choose a technology either PHP or ASP.NET. In terms of performance (not development speed) which will do better.

我要开发一个门户网站。我可以选择 PHP 或 ASP.NET 技术。在性能(而不是开发速度)方面会做得更好。

Coming to webserver, IIS vs Apache, which will perform better?

来到网络服务器,IIS 与 Apache,哪个会表现更好?

How many no. of requests/second can be handled by IIS? How many no. of requests/second can be handled by Apache?

多少没有。IIS 可以处理每秒的请求数?多少没有。Apache 可以处理每秒的请求数?

回答by DOK

Comparisons of ASP.Net to PHPcan be found in these popular questions:

可以在以下热门问题中找到ASP.Net 与 PHP 的比较

I hope these help you to assess your choices.

我希望这些可以帮助您评估您的选择。

回答by z-boss

On one of the early Henselminutes podcasts there was an interview with creators of Facebook (I think). And the main idea I took from them was: if your web project will have any kind of success then the only thing that will matter is how easy it will be for you to add more web servers and to scale you database. That's it.

在早期的 Henselminutes 播客之一中,有对 Facebook 创作者的采访(我认为)。我从他们那里得到的主要想法是:如果您的 Web 项目取得任何成功,那么唯一重要的是您添加更多 Web 服务器和扩展数据库的难易程度。就是这样。

So, I'd concentrate on the overall design of the system you're building to ensure it will scale and don't pick a language because of its performance characteristics.

因此,我将专注于您正在构建的系统的整体设计,以确保它可以扩展并且不会因为其性能特征而选择一种语言。

回答by Ram

I have done test with simple logic. ASP.NET excels very well. Whole process is taking only maximum 2 seconds in ASP.NET but in PHP it is taking too much time and it is testing our patience.

我已经用简单的逻辑做了测试。ASP.NET 非常出色。整个过程在 ASP.NET 中最多只需要 2 秒,但在 PHP 中它花费太多时间,它正在考验我们的耐心。


Here is ASP.NET code:


这是 ASP.NET 代码:

<%@ Page Language="C#" %>
<% Response.Write(DateTime.Now);
   Response.Write("<br />");
   int t = 0;
   for (int i = 1; i <= 500000000; i++)
       t = 100;
   Response.Write(DateTime.Now);
     %>


Here is PHP code:


这是PHP代码:

<?php echo date("h:i:s"); echo '<br />'; for($i=1;$i<=500000000;$i++) $t = 100; echo date("h:i:s"); ?>

回答by Shoban

Well it all depends on the website you are going to develop. Facebook is developed using php and all microsoft sites are in .net. So its up to you to decide which one is better for you.

那么这一切都取决于您要开发的网站。Facebook 是使用 php 开发的,所有微软网站都在 .net 中。因此,由您决定哪一种更适合您。

Apache with php is cheaper for you than iis and .net . ASP.net development can be faster than php.

使用 php 的 Apache 比 iis 和 .net 便宜。ASP.net 开发可以比 php 更快。

Number of users depend on the band width and your server and not on the programming languages.

用户数量取决于带宽和您的服务器,而不是编程语言。

If you can explain what exactly are you trying to develop then we will be able to explain more.

如果你能解释你到底想要开发什么,那么我们将能够解释更多。

回答by Ivo Limmen

You can even mix up a lot here. It is also possible to run an Apache server on Linux using ASP.NET (using mono). Or run Apache using ASP.NET with Mono under Windows. Personally I don't have much experience with PHP but from what I have seen around me is that PHP website have really high maintenance costs when they become large. This is not the case with a programming language that compiles (like C#/ASP.NET).

你甚至可以在这里混合很多。也可以使用 ASP.NET(使用单声道)在 Linux 上运行 Apache 服务器。或者在 Windows 下使用 ASP.NET 和 Mono 运行 Apache。就我个人而言,我对 PHP 没有太多经验,但从我周围看到的是,当 PHP 网站变大时,它们的维护成本非常高。对于可编译的编程语言(如 C#/ASP.NET)而言,情况并非如此。

回答by ylebre

Both are 'sane' choices, but have very different consequences. I know that both setups can have great performance when correctly deployed. The question is, which of the choices are you and the other members of the project more comfortable with? How much time are you willing to spend getting comfortable with either setup?

两者都是“理智”的选择,但产生的后果却截然不同。我知道这两种设置在正确部署时都可以有很好的性能。问题是,您和项目的其他成员更喜欢哪种选择?您愿意花多少时间来适应这两种设置?

Most of the performance of either scenario will be lost (or gained) within the project itself. Making the right (or wrong) choices within the code or database setup will make a terrible difference in terms of performance. This is where the best gains can be found - they are in the domain where you have direct influence on what is going on.

任一方案的大部分性能都将在项目本身中丢失(或获得)。在代码或数据库设置中做出正确(或错误)的选择将对性能产生可怕的影响。这是可以找到最佳收益的地方 - 它们位于您对正在发生的事情有直接影响的领域。

回答by Andrew Noyes

Each of these platforms are highly capable, and if you do run into performance bottlenecks with your application, it will likely be for reasons applicable to both, like database access and the efficiency of the code written. One thing to consider about ASP.NET is that you can use any .NET managed language, whereas you're locked into using PHP on that platform. Choose the language because you're familiar with it or at least more comfortable with it, the performance difference is negligible in the face of these other things.

这些平台中的每一个都具有很强的能力,如果您的应用程序确实遇到了性能瓶颈,则很可能是因为两者都适用的原因,例如数据库访问和所编写代码的效率。关于 ASP.NET 需要考虑的一件事是您可以使用任何 .NET 托管语言,而您只能在该平台上使用 PHP。选择语言是因为您熟悉它或至少对它更熟悉,性能差异在面对这些其他事情时可以忽略不计。

回答by Sukasa

If you're interested, it's also quite easy to set up IIS to run PHP, which means you can have a chance at comparing the two on a single platform.

如果您有兴趣,设置 IIS 来运行 PHP 也很容易,这意味着您可以有机会在单个平台上比较两者。

回答by Shoan

I think it really boils down to several factors.

我认为这实际上归结为几个因素。

  1. Your experience with the technology in question.
  2. The investment already made into the infrastructure. A microsoft technology shop will probably already have the skills and software required to build to asp.net application.
  1. 您对相关技术的体验。
  2. 已经对基础设施进行了投资。微软技术商店可能已经具备构建 ASP.NET 应用程序所需的技能和软件。

There are technical differences between the two, but depending on the size of your project they may not out weigh the above two factors.

两者之间存在技术差异,但根据项目的大小,它们可能不会超过上述两个因素。