.net-4.5

Service not accessible when “Enable 32-Bit Applications” set to true

时光怂恿深爱的人放手 提交于 2019-12-21 06:43:01
问题 On the development server I use IIS Veresion 7.5.7600.16385 And a Service compiled for .Net 4.5.1, Any CPU The service works fine on the development server (Win Server 2008 R2). On the client's production server however I get strange problems: (Same IIS Version, same OS version) As soon as I set "Enable 32-Bit Applications" the service's URL is no longer accessible in a browser . (Page not available) (I need the 32Bit mode because the service uses some legacy COM components) What may cause

.Net 4.5 EventSource ETW provider not showing up in provider list

纵饮孤独 提交于 2019-12-21 05:09:13
问题 I have been working on using .NET4.5 new feature ETW(EventSource). I have trouble having it show up on the trace provider lists using perfmon->Data Collector Sets. I was able to see the logs using perfview. I was able to generate manifest from EventSource class using its static method GenerateManifest. This will provide the manifest of myevents in EventSource class but it does not contain details about the channels. My question is how to add channel specific information after generating the

“Cloning” EntityConnections and ObjectContexts in Entity Framework

大城市里の小女人 提交于 2019-12-21 05:03:59
问题 (This used to be a 2-part question, but since the second part is literally the important one, I decided to split this into two separate posts. See Using Serialization to copy entities between two ObjectContexts in Entity Framework for the second part. I want to create a fairly generic "cloner" of databases for my entity model. Also, I might need to support different providers and such. I'm using ObjectContext API. I am aware of this question already and the EntityConnectionStringBuilder MDSN

Does Task.Delay start a new thread?

荒凉一梦 提交于 2019-12-21 04:03:01
问题 The following code should (at least in my opinion) create 100 Tasks , which are all waiting in parallel (that's the point about concurrency, right :D ?) and finish almost at the same time. I guess for every Task.Delay a Timer object is created internally. public static async Task MainAsync() { var tasks = new List<Task>(); for (var i = 0; i < 100; i++) { Func<Task> func = async () => { await Task.Delay(1000); Console.WriteLine("Instant"); }; tasks.Add(func()); } await Task.WhenAll(tasks); }

.NET 4 equivalent of Task.WhenAll()

做~自己de王妃 提交于 2019-12-20 17:41:14
问题 In .NET 4, is there any functional equivalent to .NET 4.5's System.Threading.Tasks.Task.WhenAll()? The goal is to wrap up multiple async tasks into a single one that is completed when all of its constituent tasks are done. 回答1: I think the closest thing built-in in .Net 4.0 is ContinueWhenAll(). You can make the continuationAction a simple tasks => tasks and use the returned Task . For performance reasons, you might want to use it with TaskContinuationOptions.ExecuteSynchronously . 回答2: In

.NET 4 equivalent of Task.WhenAll()

我们两清 提交于 2019-12-20 17:40:06
问题 In .NET 4, is there any functional equivalent to .NET 4.5's System.Threading.Tasks.Task.WhenAll()? The goal is to wrap up multiple async tasks into a single one that is completed when all of its constituent tasks are done. 回答1: I think the closest thing built-in in .Net 4.0 is ContinueWhenAll(). You can make the continuationAction a simple tasks => tasks and use the returned Task . For performance reasons, you might want to use it with TaskContinuationOptions.ExecuteSynchronously . 回答2: In

Is System.Web.Optimization part of .Net Framework 4.5?

可紊 提交于 2019-12-20 12:07:28
问题 I've been using Microsoft.Web.Optimization package for some time via the Visual Studio 2012 trial . I was thinking that the Optimization Namespace would be part of .NET 4.5 as stated here. However, I installed the new release of Visual Studio 2012 & .NET Framework 4.5, and now there's no System.Web.Optimization namespace by default! I had to install the package through NuGet Is the VS 2012 Ultimate release not yet complete? Or, is the Microsoft.Web.Optimization namespace not in .NET 4.5? 回答1:

IList<T> and IReadOnlyList<T>

谁说我不能喝 提交于 2019-12-20 09:10:52
问题 If I have a method that requires a parameter that, Has a Count property Has an integer indexer (get-only) What should the type of this parameter be? I would choose IList<T> before .NET 4.5 since there was no other indexable collection interface for this and arrays implement it, which is a big plus. But .NET 4.5 introduces the new IReadOnlyList<T> interface and I want my method to support that, too. How can I write this method to support both IList<T> and IReadOnlyList<T> without violating the

default event add/remove implementation

丶灬走出姿态 提交于 2019-12-20 03:26:28
问题 I'm looking to implement some extra logic when event handlers are added or removed to an event. I'm aware that the default implementation in .net changed recently. I'd like to keep my implementation as close to the default implementation as possible. Can anyone point me to/provide something that shows how the compliler implements events? 回答1: See this series of blog posts. In C# <4, it used simple delegate operations in lock s. In C# 4+, it uses a fancier lock-free algorithm by calling

Constant value cannot be converted to int

怎甘沉沦 提交于 2019-12-20 02:58:19
问题 I can't see why line#5 fails to compile whereas line#4 is ok. static void Main(string[] args) { byte b = 0; int i = (int)(0xffffff00 | b); // ok int j = (int)(0xffffff00 | (byte)0); // error: Constant value cannot be converted to a 'int' (use 'unchecked' syntax to override) } 回答1: Compile-time constants are checked differently to other code, basically. A cast of a compile-time constant into a type whose range doesn't include that value will always fail unless you explicitly have an unchecked