在 Mono Linux 下运行 ASP.net
我目前正在研究将我的 Web 服务器从 Windows 更改为 Linux。我目前有一个在我的网站上运行的 asp.net 程序,我想尝试在 Linux 下的 mono 下运行它。
我已将所有文件从 Windows 服务器复制到测试 Linux 服务器,但当我尝试访问该页面时,出现以下错误:
无法识别属性“requestValidationMode” (/srv/www/htdocs/mywebsitedirectory/web.config
下面是 web.config 文件的副本
<?xml version="1.0" encoding="UTF-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="DownloadManagerDB" connectionString="Server=localhost;Port=3306;Database=downloads;Uid=public;Pwd=54mCuw90;pooling=false;" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<system.web>
<customErrors mode="Off" />
<httpRuntime requestValidationMode="2.0" maxRequestLength="16384" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies></compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument>
<files>
<clear />
<add value="index.aspx" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="default.aspx" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="index.php" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
它看起来好像在错误页面上 Mono 认为它的 asp.net 版本 2 当它实际上设置为 .net 4 时。我我使用的是 mono 版本 2.10.6,它支持 .net 4。
感谢您提供的任何帮助
更新: 。 运行 ps auxwww | 的输出grep 单声道
wwwrun 12029 0.0 0.8 48800 8100 ? SSL 19:55 0:00 /usr/bin/mono /usr/lib/mono/2.0/mod-mono-server2.exe --文件名 /tmp/mod_mono_server_global --nonstop --master 根 12177 0.0 0.0 2524 768 点/1 S+ 20:04 0:00 grep --color=auto mono
I am currently investigating changing my Web server from windows to linux. I currently have an asp.net program that runs on my site and I want to try and get this working on Linux under mono.
I have copied over all of the files from my Windows server to my test linux server but when I try to access the page I get the following error:
Unrecognised attributed 'requestValidationMode'
(/srv/www/htdocs/mywebsitedirectory/web.config
Below is a copy of web.config file
<?xml version="1.0" encoding="UTF-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="DownloadManagerDB" connectionString="Server=localhost;Port=3306;Database=downloads;Uid=public;Pwd=54mCuw90;pooling=false;" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
<system.web>
<customErrors mode="Off" />
<httpRuntime requestValidationMode="2.0" maxRequestLength="16384" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /></assemblies></compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument>
<files>
<clear />
<add value="index.aspx" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="default.aspx" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="index.php" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
It looks as if on the error page Mono thinks its its asp.net version 2 when it is actually set to .net 4. I'm using mono version 2.10.6 which says that it supports .net 4.
Thanks for any help you can provide.
UPDATED:
Output from running ps auxwww | grep mono
wwwrun 12029 0.0 0.8 48800 8100 ? Ssl 19:55 0:00
/usr/bin/mono /usr/lib/mono/2.0/mod-mono-server2.exe --filename
/tmp/mod_mono_server_global --nonstop --master root 12177 0.0
0.0 2524 768 pts/1 S+ 20:04 0:00 grep --color=auto mono
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就像@Eugen Rieck 指出的那样,您需要配置 mod-mono-server4 而不是 server2。
在本文之后,
http://docs.orchardproject.net/Documentation /Running-Orchard-on-Mono?Code=1
您应该转到 Apache 设置,并将 MonoServerPath 更改为 /usr/bin/mod-mono-server4 (或您机器上的有效路径)然后你可以再次测试一下这个属性是否可以正确处理。
Like @Eugen Rieck pointed out, you need to configure mod-mono-server4 instead of server2.
Following this article,
http://docs.orchardproject.net/Documentation/Running-Orchard-on-Mono?Code=1
you should go to your Apache setting, and change MonoServerPath to /usr/bin/mod-mono-server4 (or the valid path on your box) Then you can test again to see if this attribute can be handled properly.