Apache加PHP和IIS加ASP的比较

经个10天的折腾,终于领教了IIS和ASP,实在是不喜欢。

由于这个域名1or9.com目前在Godaddy,而Godaddy提供一个免费的空间。考虑到不用白不用的原则,就把1or9.com的空间转了过去。因为已经有Linux空间(Apache+PHP),就选择了一个Windows空间(IIS+ASP),另外我还想试试一直想用z-blog系统。没有想到这次转移就是一个恶梦,最终以转回Linux空间而收场。

php logo

整个过程中碰到的下面几个问题。第一就是我在1or9.com下面有个子域名joke.1or9.com,这个是以前做过站的一个域名,后来那个站换新域名到www.xiaohuayoumo.com。所以我需要把这个子域名301永久定向到新域名上。用Apache做服务器的话非常简单,只要在根目录下面放上一个.htaccess文件,想怎么重定向就怎么重定向。在另外一篇文章网站换域名-301永久转向和cname是完全不同的概念有对.htaccess文件的说明。用IIS,如果对IIS服务器有完全控制,行不行我不是非常懂。但是用IIS的虚拟主机是肯定不行的。第二就是数据库的链接。PHP连接数据库,只要主机,数据库名字,用户,密码4个参数。ASP连接数据库,分OLEDB和ODBC二种方法。z-blog用的是OLEDB,但是Godaddy的例子代码只有建立dsn,然后用ODBC链接。这导致了第三个问题,我用z-blog一直很不稳定,间歇的出现网站无法访问错误(一会儿好,一会儿不好)。我搞不清楚是数据库链接的问题,还是免费空间的问题。这个问题也是最终让我转回Linux空间的直接原因,因为我实在解决不了。ASP报的错,基本没有啥价值,很难调试,这个比PHP又差很多。我的出错信息帖在最后面,其中IIS7Injector.InjectedContentStream.Write,google了半天也不知道是个啥东西。

折腾了一天,终于全部换回来了,一切都恢复了,感觉Linux+PHP真好。

Server Error in ‘/’ Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]   IIS7Injector.InjectedContentStream.Write(Byte[] buffer, Int32 offset, Int32 count) +146   System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr) +265   System.Web.HttpResponse.FilterOutput() +80   System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +54   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

Version Information: Microsoft .NET Framework Version:2.0.50727.1434; ASP.NET Version:2.0.50727.1434

Leave a Reply

Your email address will not be published.