Solution to the problem of uploading mvc to Mei Orange Cloud Virtual Machine Series

  • 2021-08-21 20:07:22
  • OfStack

I wrote a small website with vs2015,. Net Framework4.5, mvc 5, and published it on the local iis normally. I applied for a cloud virtual machine in Mei Orange. Some problems encountered in the publishing process are recorded as follows:

1. The version supported by the server is relatively low

Open the website after uploading and display:

HTTP Error 404.0-Not Found

The resource you are looking for has been deleted, renamed, or temporarily unavailable.

Asked about the technical support of Mei Orange, saying that it can only support. net framework4.0 and mvc4.

There is no way but to try to lower the version. In vs2015, all project target frameworks in the solution were changed to. net framework 4.0. In NuGet, mvc5 was uninstalled and mvc4 was installed. Immediately, a heap of errors occurred, especially the features in some extended classes of entity classes

[MaxLength (128, ErrorMessage = "Typical customer length cannot exceed 128 characters")]
Can't recognize it. There are many versions of the referenced library, so there is no way to start.

2. One dll file is missing

So I simply got an vs2012, rebuilt the solution in vs2012, selected ASP. NET MVC4 Web application, and selected. net framework4.0 as the target framework. For the time being, only one controller home and one view index were built. After passing locally, they were uploaded to the cloud virtual machine, and there were still 404 errors.

Then contact the technical staff of Mei Orange, and the other party helped me open a detailed error report.

I added to web. config


 <system.web>
  <customErrors mode="Off" />
 </system.web>

Visit the website again and prompt that it cannot be loaded......

Then, according to the prompts, I uploaded: System. Net. Http. dll, System. Web. Http. dll, System. Web. Http. WebHost. dll, and finally I can see my view.

3. Version problem of Newtonsoft. Json after adding UEditor

Rebuild projects with vs 2012, and copy each project in the original vs 2015 solution one by one.

After copying the plug-in UEditor, run 1 straight prompt: Failed to load the file or assembly "Newtonsoft. Json, Version=4. 5.0....... and look at the reference to Newtonsoft. Json. dll in UEditor\ net\ Newtonsoft version 6.0. 2.16931. I remove the reference and re-reference Newtonsoft. Json in packages\ Newtonsoft. 4.5. 6\ lib\ net40, but look at the reference's Newtonsoft. Json property again and it's still UEditor\ Version 6.0 of Newtonsoft. Json, I am a little confused, why does the re-reference not take effect?

After a lot of trouble, I finally modified the web. config file


 <!-- Solve accession UEditor Is prompted that the file or assembly could not be loaded " Newtonsoft.Json, Version=4.5.0.0...... Errors of -->
 <runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
   </dependentAssembly>
  </assemblyBinding>
 </runtime>

This problem is solved by pointing all versions of Newtonsoft. Json to the current 6.0 version.

4,401.3 Error

The vs2012 written program, in the local debugging through, and then upload, visit the website prompt 401.3 error, should be the authority problem, please orange technology under 1, static html page can be displayed, but home/index is still unable to open, also do not show detailed error prompt, according to the method found in web. config to add


 <system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
  <!-- After uploading to the cloud virtual machine, you must add this configuration item to open the web page -->
  <modules runAllManagedModulesForAllRequests="true" /> 
 </system.webServer>

Finally, I saw the detailed prompt that I couldn't load the file, and then uploaded the three files to bin according to the prompt, and then visited the website, and finally I could run normally.

5. I still want to praise the technical support staff of Mei Orange for answering and solving problems quickly and patiently.


Related articles: