Today all development environments have migrated to the visual Studio Code + command-line compilation publication under Mac OS, while the running server is CentOS7, and Windows is nothing to associate with. As long as you relese compile and run successfully in the same running environment as the server, migrating to a real server is not difficult.
Here are the 3 issues and workarounds that are encountered after migrating to version 2.0
1: sometimes DLLs are not updated in real-time (not every time, and this happens only on CentOS) sometimes you need to pass all the edge files associated with the DLL (for example, the matching Xxx.config.json, Xxx.runtime.json), it will actually be updated immediately after restarting the application ( Note This is the restart application), or the restart program is not valid, once the situation occurs, even after restarting the system ( Note that this is a reboot system ), It still loads past old DLLs and restarts the system again after a few hours to load the latest DLLs.
Although it is unreasonable, but this is my real case, the reason why, do not know, there is no time to toss, this kind of mechanism can be proved from the side: When you run the service, you can run the directory to update, or even remove the DLL, if not restarted, the running program will not be affected, Note that the Linux version loading mechanism differs from Mac and Windows, it may be that the existing DLLs are all copied to a place, and to compare the time timestamp and content of the companion JSON file will not run.
Other Linux will not be so, not clear.
2:HTTPS configuration is different from previous
Kestrel has evolved into a standalone and complete server, there is no problem with real requests, but the 1.1 and later versions of HTTPS are no longer applicable and need to be changed to the following methods:
var WebServer = new Webhostbuilder () . Usekestrel (options = options. Listen (Ipaddress.any, serviceport, listenoptions = { Listenoptions.usehttps (New X509Certificate2 (" Your. pfx "," Password for PFX file ")); Options. Limits.maxconcurrentconnections = +; Options. Limits.maxconcurrentupgradedconnections = +; Options. Limits.maxrequestbodysize = ten * 1024x768; })) . Usecontentroot (appcontext.basedirectory) . Usestartup<startup> () . Build (); Webserver.run ();
Believe that many people through the letsencript to get HTTPS, the original key is not the PFX format, just find an online conversion can be.
3, dependent package change
I have not used preview 3, but migrated from Preview2 to the official version 2.0, maybe you will be the same as me after the migration encountered loading view, the "Cannot find compilation library location for package ' M Icrosoft. Win32.registry ", dazzling a look at the name of the package, frighten dead, actually it and Win32 nothing necessarily related. Workaround:
Add in csproj:
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
And:
<packagereference include= "Microsoft.Win32.Registry" version= "4.4.0"/>
Make sure that the refs folder exists in your running directory after the compilation is published, and that the basic DLLs are system.xxxx, microsoft.xxx, and so on.
This is just one example, when I was searching for this problem in Google, I also found that others encountered similar other packages cannot find, the same reason.
The following are unresolved, waiting for you to discuss
1, I am currently compiling the project into a full-platform generic Dll,mac compiled DLL put into the CentOS run (put to Windows also line), the actual dependency of the package exists in the system installed in the CLR. Another way is to specify runtime in the compilation process, for the CentOS compilation, get a complete binary, green security deployment of the full run package (capacity will be large), can be thrown into the production environment directly to run, this situation I only in 1.0 beta when the Windows successfully compiled, Now the Mac can't compile, the command line suspended animation for 20 minutes did not respond.
2, want to try visual Studio for MAC, but can not be released release, GUI can not be configured, set to release, dazzling a window and then go back to debug (I understand Windows visual Studio Unified in the solution configuration of the truth, useless), manually modify the csproj configuration for release also useless, gave up (of course, this is my personal ability, I believe that others can be).
3, I chose CentOS 7 because it has a minimal version, memory and other resource requirements are low, not because it is redhat twins, if any of the people found that there is better cost-effective Linux, but also hope to recommend a copy, first thanked.
4,core is officially cross-platform, but Microsoft has another nuclear weapon: does the. NET native have any of the following? It's been silent ever since I saw a support for Windows Phone only.
A day has just been released and there may be more migration issues to discover
Core 2.0 DLL Real-time update, HTTPS, dependency package change problem and resolution