.net-4.5.2

Redis distributed increment with locking

假如想象 提交于 2019-12-18 11:56:38
问题 I have a requirement for generating an counter which will be send to some api calls. My application is running on multiple node so some how I wanted to generate unique counter. I have tried following code public static long GetTransactionCountForUser(int telcoId) { long valreturn = 0; string key = "TelcoId:" + telcoId + ":Sequence"; if (Muxer != null && Muxer.IsConnected && (Muxer.GetDatabase()) != null) { IDatabase db = Muxer.GetDatabase(); var val = db.StringGet(key); int maxVal = 999; if

Configuring .NET Framework 4.5.2 in IIS 8.0

江枫思渺然 提交于 2019-12-18 04:20:33
问题 In my Windows Server 2012, I have installed .NET Framework 4.5.2, but it is not listing in IIS when I tried to change one application pool's .NET Framework. 回答1: The application pool should be set to .net 4.0, that includes all updates like 4.5.1 and 4.5.2 All other settings are through config, for example: <system.web> <compilation debug="true" targetFramework="4.5.1" /> <httpRuntime targetFramework="4.5.1" /> </system.web> 回答2: install Microsoft .NET Framework 4.5.2 Developer Pack https:/

Why x86 JIT is smarter than x64?

醉酒当歌 提交于 2019-12-14 02:35:34
问题 I'm running a very simple program static void Main(string[] args) { Console.WriteLine(Get4S()); Console.WriteLine(Get4()); } private static int Get4S() { return 4; } private static int Get4() { int res = 0; for (int i = 0; i < 4; i++) { res++; } return res; } when it works under x86 it inlines Get4S method and Get4 asm code is: 00000000 push ebp 00000001 mov ebp,esp 00000003 xor eax,eax 00000005 inc eax 00000006 inc eax 00000007 inc eax 00000008 inc eax 00000009 pop ebp 0000000a ret BUT when

Cannot loop through list A(icollection) of generic type B where A and B both implement same interface

元气小坏坏 提交于 2019-12-13 21:07:21
问题 The intro is a bit tedious, but is just for clearity! Some might even learn something from it or get some handy insights. My question is found at the bottom. I really hope someone can help me! I have this interface public interface IEFEntity { object GetPKValue(); bool PKHasNoValue(); } All my automatic genereted EF classes implement this interface and implement the 2 methods. This is done via a separate file using partial classes so the implementation is not gone when regenerating the EF

“Use of unassigned local variable” in if statement with TryParse with the use of dynamic

拜拜、爱过 提交于 2019-12-12 09:42:04
问题 I've just typed in the following code to a VS2015 .Net v4.5.2 console application: dynamic fromString = "blah", toString = "blah2"; DateTime fromDate, toDate; if (DateTime.TryParse(fromString.ToString(), out fromDate) && DateTime.TryParse(toString.ToString(), out toDate)) { Console.WriteLine(fromDate); Console.WriteLine(toDate); } Somewhat unexpectedly I'm getting the error "Use of unassigned local variable toDate". I didn't expected it because the if statement is only entered if 'toDate' is

SignalR net45 gives 401 Unauthorized on specific user/machine combinations

末鹿安然 提交于 2019-12-12 01:19:41
问题 We recently updated a WPF app and all of its NuGet dependencies to .NET 4.5.2 and find that some users are receiving HTTP 401 Unauthorized errors from SignalR. The is using Windows Authentication via PrincipalUserIdProvider. I receive the 401 error on the first POST to SignalR after connecting to SignalR but here are many reasons why this is a strange issue: It works when I have Fiddler running It works when I run the app on Citrix It works when I run the app with a Run As on another person's

asp:DataGrid visibility with async?

北城以北 提交于 2019-12-11 14:34:07
问题 .NET 4.5.2, IIS 8.5 on Windows 8.1 x64. I have a single ASP.NET web site at /localhost/. I've got a real async-puzzle here that I've been wrestling with for two days now. I'm reworking some long-running reports to be async, but I can demonstrate my problem with very simple code. I have an asp:DataGrid on my page that I've initially set visible="false". It should only be visible if it is populated. My problem is, if the code that populates it is async I don't see the grid! Here's the markup:

Redis Pop list item By numbers of items

泄露秘密 提交于 2019-12-11 12:45:55
问题 I have a distributed system where In one place i insert around 10000 items in a redis list then Call my multiple applications hook to process items. what i need is to Have some ListLeftPop type of methhod with numbers of items. It should remove items from the redis List and return to my calling application. I am using Stackexchange.Resis.extension My current method just for get (not pop) is public static List<T> GetListItemRange<T>(string key, int start, int chunksize) where T : class { List

Why do my “random” MachineKey's Validation Key and Decryption Key both start with the same bytes?

こ雲淡風輕ζ 提交于 2019-12-11 02:29:12
问题 I have an MVC app using .NET 4.5.2. In this app, I set the MachineKey as follows: <machineKey compatibilityMode="Framework45" validationKey="25E5749C117E4072E721DA0B8A88B052AAA821CA1D1638C10F0DBF528C19D296134A996B5FA934E1032C9BA9FBDC45EF8806153D683EF4F6C833E7BF6639C513" decryptionKey="DC7ACBAD80BC8EDBD1429F102CEC1C210604DA6C3E6421A4" validation="SHA1" decryption="AES" /> I then run my GetMachineKey code (which has a dependency on ReflectionMagic to keep the reflection code simple when

ASP.NET MVC Overriding Index action with optional parameter

跟風遠走 提交于 2019-12-10 11:25:51
问题 I want to accept /User/ and /User/213123 Where 213123 is a parameter (user_id) Here is my RouteConfig.cs : routes.MapRoute( name: "user", url: "{controller}/{action}/{username}", defaults: new { controller = "User", action = "Index", username = UrlParameter.Optional } ); And my UserController.cs : public ActionResult Index() { ViewData["Message"] = "user index"; return View(); } [Route("user/{username}")] public ActionResult Index(string username) { ViewData["Message"] = "!" + username + "!";