Problems with migrating Asp.net to the mono environment in Linux

Source: Internet
Author: User
Tags mscorlib

Recently, we need to deploy an Asp.net site in Linux.

 

Asp.net uses the mvc3 framework, which also includes WebService and WCF services.

 

As for mono's cloud installation, there will be a lot of Internet.

 

I have not solved some of the following problems. However, the website is running normally.

 

When I put it on for the first time, the compilation will fail:

 

Compilation Error

Description:Error compiling a resource required to service this request. review your source file and modify it to fix this error.

Compiler error message:: at System.Reflection.AssemblyName..ctor (System.String assemblyName) [0x00045] in /data/tmp/mono-2.10/mcs/class/corlib/System.Reflection/AssemblyName.cs:93

~ /Global. asax

 

 

Show detailed compiler output:

 

Version Information:Mono runtime version:2.10 (tarball Fri May 4 11:10:52 CST 2012); ASP. NET version:4.0.30319.

Well, I have a headache. It may be because of the previous project creation problem. I re-created the project and added the previous files. The result is good. I don't care about this anymore.

 

The following problem occurs again. There is a WebService in the site, and the website cannot be accessed. I keep reporting:

System. web. compilation. compilationexception cs1703: an assembly with the same identity 'mscorlib, version = 4.0.0.0, culture = neutral, publickeytoken = b77a5c561934e089 'has already been imported. consider removing one of the references Description: Error compiling a resource required to service this request. review your source file and modify it to fix this error. details: cs1703: an assembly with Same identity 'mscorlib, version = 4.0.0.0, culture = neutral, publickeytoken = comment 'has already been imported. consider removing one of the references Error origin: Compiler error source file :~ /Defaultwsdlhelpgenerator. aspx exception stack trace: At system. web. compilation. assemblybuilder. buildassembly (system. web. virtualpath, system. codedom. compiler. compilerparameters options) [0x00000] In: 0 at system. web. compilation. assemblybuilder. buildassembly (system. web. virtualpath) [0x00000] In: 0 at system. web. compilation. buildmanager. generateassembly (system. web. compilation. assemblybuilder abuilder, system. web. compilation. buildprovidergroup group, system. web. virtualpath VP, Boolean Debug) [0x00000] In: 0 at system. web. compilation. buildmanager. buildinner (system. web. virtualpath VP, Boolean Debug) [0x00000] In: 0 version information: 2.11.1 (tarball Wed May 9 23:15:56 CST 2012); ASP. net version: 4.0.30319.17020

 

I am also sad that mono in Windows can run, but I did not solve this problem once I put it in Linux. Instead, I changed it to WCF .. OK. Although it is easy to cut WebService into WCF, I am still depressed. Why does WebService fail. Okay, it's okay. I don't have to worry about it either. It is also good to use WCF.

 

Ah. The following question is most painful for me. Other WebServices and WCF should be referenced in the website.

In general, we can directly reference it. A new client can be accessed, but it does not work in Linux.

System. reflection. reflectiontypeloadexception the classes in the module cannot be loaded. description: HTTP 500. error Processing request. details: Non-web exception. exception origin (name of application or object): mscorlib. exception stack trace: At (wrapper managed-to-native) system. reflection. assembly: gettypes (system. reflection. assembly, bool) at system. reflection. assembly. gettypes () [0x00000] In: 0 at system. servicemodel. configuration. configutil. gettypefromconfigstring (system. string name, namedconfigcategory category) [0x00000] In: 0 at system. servicemodel. channelfactory. applyconfiguration (system. string endpointconfig) [0x00000] In: 0 at system. servicemodel. channelfactory. initializeendpoint (system. string endpointconfigurationname, system. servicemodel. endpointaddress remoteaddress) [0x00000] In: 0 at system. servicemodel. channelfactory '1 [JM. common. examples. web. monoserver. itest2]... ctor (system. string endpointconfigurationname, system. servicemodel. endpointaddress remoteaddress) [0x00000] In: 0 at system. servicemodel. clientbase '1 [JM. common. examples. web. monoserver. itest2]. initialize (system. servicemodel. instancecontext instance, system. string endpointconfigurationname, system. servicemodel. endpointaddress remoteaddress) [0x00000] In: 0 at system. servicemodel. clientbase '1 [JM. common. examples. web. monoserver. itest2]... ctor (system. servicemodel. instancecontext instance, system. string endpointconfigurationname) [0x00000] In: 0 at system. servicemodel. clientbase '1 [JM. common. examples. web. monoserver. itest2]... ctor (system. servicemodel. instancecontext instance) [0x00000] In: 0 at system. servicemodel. clientbase '1 [JM. common. examples. web. monoserver. itest2]... ctor () [0x00000] In: 0 at JM. common. examples. web. monoserver. itest2client .. ctor () [0x00000] In: 0 at JM. common. examples. web. testserver. page_load (system. object sender, system. eventargs e) [0x00000] In: 0 at system. web. UI. control. onload (system. eventargs e) [0x00000] In: 0 at system. web. UI. control. loadrecursive () [0x00000] In: 0 at system. web. UI. page. processload () [0x00000] In: 0 at system. web. UI. page. processpostdata () [0x00000] In: 0 at system. web. UI. page. internalprocessrequest () [0x00000] In: 0 at system. web. UI. page. processrequest (system. web. httpcontext context) [0x00000] In: 0

 

Besides this, an error with the null key is reported, and some referenced configurations cannot be found.

Then I only need to try manual new,

 

  1. VaR binding = new basichttpbinding ("basichttpbinding_itest2 ");
  2. VaR EPA = new endpointaddress ("http: // 127.0.0.1: 8080/test2.svc ");
  3. VaR client = new monoserver. itest2client (binding, EPA );
  4. VaR r = client. dowork ();

 

 

 

Basichttpbinding_itest2 is the binding configuration name in webconfig, so it passes smoothly. This problem does not solve me. Can't mono automatically read it. If I had to manually instantiate it, Microsoft's. NET would not have this problem.

 

You can also reference WebService. You must manually instantiate the instance to avoid errors. I cannot decide on Windows.

 

The last problem is in mvc3. We often use model to generate page controls. In this way, model. XX can be directly used in the background to read the value of this control during submission.

However, in Linux, Mono does not work. The model attributes are all empty and you have to write <input and so on. Obtain the backend request. Form ["name.

The problem may be that MVC in Mono does not support this.

 

If prawns have better solutions to the above problems. You can tell Xiaosheng, ths

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.