当前位置:网站首页>The great change of. Net 5: Lost Historical Technology

The great change of. Net 5: Lost Historical Technology

2020-12-10 16:19:31 InfoQ

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" In this paper , We're going to review some of the things that didn't get into .NET Core The historicity of .NET technology . What's interesting is that , These technologies API It's been copied , This implies that Microsoft was thinking about the future of .NET Core To implement them in ."}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":" Global assembly cache "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Global assembly cache (GAC) The theory behind it is , all .NET Libraries can be stored in a single centralized location . In this way , It is associated with "},{"type":"link","attrs":{"href":"https:\/\/en.wikipedia.org\/wiki\/Component_Object_Model","title":"","type":null},"content":[{"type":"text","text":"COM"}]},{"type":"text","text":" The library is similar to . But with COM The difference is , It can store multiple versions of each library . In this way , Microsoft wants to avoid trouble 90 The era of app “DLL hell ” scene ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" however , The version problem still exists . Besides , The need to obtain a code signing certificate and Windows Vista The increased security brought about by GAC Become a nuisance Technology . To .NET 4.5 When it was released , Few applications will GAC For non Microsoft Libraries . The main exception is the commercial library , But even these libraries have turned to NuGet A more friendly delivery model ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" therefore , It's not surprising , Microsoft is in .NET Core And fundamentally changed their philosophy . In the new model , All library dependencies are deployed with the application , This allows the application to interact with other .NET Core Applications are isolated . therefore ,.NET Core There is no GAC The concept of ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" For all that ,GAC API stay .NET Core Still exists in . They don't do much , for example , Indicates whether the assembly is in GAC Properties in are hard coded to return false."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" In order to further clarify the intention , be-all GAC API Now it's all marked as obsolete , Microsoft is considering removing them in future versions ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"Remoting"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https:\/\/en.wikipedia.org\/wiki\/.NET_Remoting","title":"","type":null},"content":[{"type":"text","text":".NET Remoting"}]},{"type":"text","text":" Is subject to "},{"type":"link","attrs":{"href":"https:\/\/en.wikipedia.org\/wiki\/Distributed_Component_Object_Model","title":"","type":null},"content":[{"type":"text","text":"DCOM"}]},{"type":"text","text":" and "},{"type":"link","attrs":{"href":"https:\/\/en.wikipedia.org\/wiki\/Java_remote_method_invocation","title":"","type":null},"content":[{"type":"text","text":"Java Remoting(Java RMI)"}]},{"type":"text","text":" Inspired by the . The basic idea of these three methods is that one application can use proxy objects to manipulate real objects running in another application . Although it works technically , but .NET Remoting It's never been popular , Because it's hard to use it properly , And people generally think it's fragile ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Consider this ,.NET Core Never realized .NET Remoting API. It's like GAC API equally , It has only non operational placeholders . therefore , They are also marked obsolete , And the ultimate goal is to delete it ."}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":" Code access security "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Continue with this theme ,"},{"type":"link","attrs":{"href":"https:\/\/docs.microsoft.com\/en-us\/dotnet\/framework\/misc\/code-access-security","title":"","type":null},"content":[{"type":"text","text":" Code access security (CAS)"}]},{"type":"text","text":" It's another kind of API Be copied to .NET Core in , But marked obsolete .NET Framework technology ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Code access security was created in Docker Before you isolate the container . stay .NET Framework Time , Multiple applications will be hosted in a single Internet Information Server(IIS) In the example . Theoretically , Each application will be isolated into a separate application domain , But to break this isolation and interfere in IIS Other applications running in are not difficult ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Code access security was created to limit this possible damage . The basic idea is this , dangerous API It's going to be added the attribute of risk .IIS Such hosts can be configured to run with different “ trust ” Level applications , In theory , It's putting them in a sandbox ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"CAS Another use for browser managed applications . As early as Silverlight Before appearance , You can already be in Internet Explorer Run in Windows Forms application . The trust level of an application depends in part on where it is loaded from , Internal sites will be given higher permissions ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" But with a lot of early .NET The technology is the same , To achieve it correctly CAS It is difficult to . There are many ways for malicious applications to bypass CAS Limit , Benign applications are often limited by these limitations . result , Browser hosted applications quickly disabled it , and IIS To a great extent, it ignores CAS Trust level ."}]},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"Thread.Abort"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" This may surprise you ."},{"type":"link","attrs":{"href":"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.threading.thread.abort","title":"","type":null},"content":[{"type":"text","text":"Thread.Abort"}]},{"type":"text","text":" stay .NET Core It has never been realized in . Although it is always considered dangerous , But it's inevitable . stay ASP.NET in , Something as simple as a request timeout or a client disconnect triggers a "},{"type":"codeinline","content":[{"type":"text","text":"Thread.Abort"}]},{"type":"text","text":" call . If you don't write serious code to deal with , This can lead to resource leaks , For example, a lock is acquired or a database transaction is opened ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" To ASP.NET Core Is created ,"},{"type":"codeinline","content":[{"type":"text","text":"CancellationToken"}]},{"type":"text","text":" Has become a safe and widely accepted "},{"type":"codeinline","content":[{"type":"text","text":"Thread.Abort"}]},{"type":"text","text":" A replacement , So there's no need to be in .NET Core It was implemented in the first version of . Even though .NET Core It has been extended to Web Off site , But none of the other major application frameworks need "},{"type":"codeinline","content":[{"type":"text","text":"Thread.Abort"}]},{"type":"text","text":", So it will continue to throw "},{"type":"codeinline","content":[{"type":"text","text":"PlatformNotSupportedException"}]},{"type":"text","text":"."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" stay .NET 5 in , The method was eventually marked obsolete ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":" Link to the original text :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https:\/\/www.infoq.com\/news\/2020\/12\/net-5-breaking-changes-2\/","title":"","type":null},"content":[{"type":"text","text":".NET 5 Breaking Changes: Historic Technologies"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/202012101619005710.html

随机推荐