让我们看看这里是否有人可以帮助解决使用mod_mono在apache上部署MVC3网站的问题。
我的单声道安装是3.10.1(与3.10.0完全相同)和最新的mod_mono和xsp。我从git分支获得的源代码安装了mono。
问题是我在尝试验证用户时遇到的异常。当我调用Membership.Validate并且是:
时发生异常System.InvalidOperationException
Failed to map path '/'
at System.Web.HttpRequest.MapPath (System.String virtualPath, System.String baseVirtualDir, Boolean allowCrossAppMapping) [0x001a4] in /usr/local/src/mono/mcs/class/System.Web/System.Web/HttpRequest.cs:1563
at System.Web.HttpRequest.MapPath (System.String virtualPath) [0x0000d] in /usr/local/src/mono/mcs/class/System.Web/System.Web/HttpRequest.cs:1520
at System.Web.Hosting.HostingEnvironment.MapPath (System.String virtualPath) [0x00042] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Hosting/HostingEnvironment.cs:156
at System.Web.Hosting.DefaultVirtualPathProvider.DirectoryExists (System.String virtualDir) [0x00016] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Hosting/DefaultVirtualPathProvider.cs:59
at System.Web.Configuration.WebConfigurationManager.FindWebConfig (System.String path, System.Boolean& inAnotherApp) [0x0001a] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:592
at System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration (System.String path, System.String site, System.String locationSubPath, System.String server, System.String userName, System.String password, Boolean fweb) [0x00026] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:360
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x0000d] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:456
at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path) [0x00000] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs:435
at System.Web.Security.SqliteMembershipProvider.Initialize (System.String name, System.Collections.Specialized.NameValueCollection config) [0x0028b] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Security/SqliteMembershipProvider.cs:143
at System.Web.Configuration.ProvidersHelper.InstantiateProvider (System.Configuration.ProviderSettings providerSettings, System.Type providerType) [0x00069] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/ProvidersHelper.cs:61
at System.Web.Configuration.ProvidersHelper.InstantiateProviders (System.Configuration.ProviderSettingsCollection configProviders, System.Configuration.Provider.ProviderCollection providers, System.Type providerType) [0x0003e] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Configuration_2.0/ProvidersHelper.cs:72
at System.Web.Security.Membership..cctor () [0x0001a] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Security/Membership.cs:107
我尝试过使用自定义成员资格提供程序的网站,而另一个使用默认成员资格的网站都显示相同的问题。 我在单声道3.10.1和3.10.0上的两个不同的服务器上试过这些。
我使用自动配置工具配置了网站:http://go-mono.com/config-mod-mono/并使用它提供的默认配置:
Alias /boacommander "/var/www/html/boacommander"
MonoServerPath boacommander "/usr/bin/mod-mono-server4"
MonoDebug boacommander true
MonoSetEnv boacommander MONO_IOMAP=all
MonoApplications boacommander "/boacommander:/var/www/html/boacommander"
<Location "/boacommander">
Allow from all
Order allow,deny
MonoSetServerAlias boacommander
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
</IfModule>
以下dll将沿网站复制:
异常发生在System.Web中,所以如果我复制一个System.Web.dll,我会在进入登录页面之前得到这个异常:
Could not find method 'Void SetHostingEnvironment()' in type 'System.Web.Hosting.ApplicationHost'
at (wrapper xdomain-invoke) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate)
at (wrapper remoting-invoke-with-check) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate)
at System.Web.Hosting.ApplicationHost.CreateApplicationHost (System.Type hostType, System.String virtualDir, System.String physicalDir) [0x002fb] in /usr/local/src/mono/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs:241
at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer server, Mono.WebServer.WebSource webSource) [0x00048] in /usr/local/src/xsp/src/Mono.WebServer/VPathToHost.cs:143
at Mono.WebServer.Apache.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean v_quiet) [0x00277] in /usr/local/src/xsp/src/Mono.WebServer.Apache/main.cs:161
at (wrapper remoting-invoke-with-check) Mono.WebServer.Apache.Server:RealMain (string[],bool,Mono.WebServer.IApplicationHost,bool)
at Mono.WebServer.Apache.Server.Main (System.String[] args) [0x00034] in /usr/local/src/xsp/src/Mono.WebServer.Apache/main.cs:58
[ERROR] FATAL UNHANDLED EXCEPTION: System.Runtime.Serialization.SerializationException: Could not find method 'Void SetHostingEnvironment()' in type 'System.Web.Hosting.ApplicationHost'
Server stack trace:
at System.Reflection.MemberInfoSerializationHolder.GetRealObject (StreamingContext context) [0x00215] in /usr/local/src/mono/mcs/class/corlib/System.Reflection/MemberInfoSerializationHolder.cs:158
at System.Runtime.Serialization.ObjectRecord.LoadData (System.Runtime.Serialization.ObjectManager manager, ISurrogateSelector selector, StreamingContext context) [0x00133] in /usr/local/src/mono/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs:596
at System.Runtime.Serialization.ObjectManager.DoFixups () [0x00074] in /usr/local/src/mono/mcs/class/corlib/System.Runtime.Serialization/ObjectManager.cs:85
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader reader) [0x0000f] in /usr/local/src/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:141
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x0004d] in /usr/local/src/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:107
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x0007a] in /usr/local/src/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:177
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in /usr/local/src/mono/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:134
at System.Runtime.Remoting.RemotingServices.DeserializeCallData (System.Byte[] array) [0x0000f] in /usr/local/src/mono/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs:794
at (wrapper xdomain-dispatch) System.AppDomain:DoCallBack (object,byte[]&,byte[]&)
如果你这样做该死的,如果你不这样做该死的,那么我该怎么做才能解决这个问题呢?
编辑附加信息:使用mono 3.12.0(git branch)
时会发生同样的事情