.net-4.5

Memory leak when ThreadLocal<T> is used in cyclic graph

荒凉一梦 提交于 2019-12-09 12:41:44
问题 I just came across this weird 'behavior' of the Garbage Collector concerning System.Threading.ThreadLocal<T> that I can't explain. In normal circumstances, ThreadLocal<T> instances will be garbage collected when they go out of scope, even if they aren't disposed properly, except in the situation where they are part of a cyclic object graph. The following example demonstrates the problem: public class Program { public class B { public A A; } public class A { public ThreadLocal<B> LocalB; }

Register certificate to SSL port

流过昼夜 提交于 2019-12-09 11:17:12
问题 I have a windows service (running as LocalSystem) that is self-hosting an OWIN service (SignalR) and needs to be accessed over SSL. I can set up the SSL binding on my local development machine just fine - and I can access my service over SSL on that same machine. However, when I go to another machine and try to run the following command I receive an error: Command: netsh http add sslcert ipport=0.0.0.0:9389 appid={...guid here...} certhash=...cert hash here... Error: SSL Certificate add

Is EntityFramework available for Windows 8 Store Apps?

狂风中的少年 提交于 2019-12-09 08:36:35
问题 Is EntityFramework available for Windows 8 Store Apps? I'm using Visual Studio 2012 Express for Windows 8. I'm starting to wonder because I can't make it work. I installed the Entity Framework package from NuGet I added System.Data.Entity and System.Data.Design to the project But no matter what I do, DbContext isn't recognized... Any ideas? EDIT: EntityFramework isn't available for Windows Store Apps. I don't understand Microsoft position on this, they suck. The other solution is to use

Is MVC4 baked into .NET 4.5?

旧街凉风 提交于 2019-12-09 07:51:49
问题 A lot of release notes for Visual Studio 2012 talk about .NET 4.5 and MVC4, but I can't tell if MVC4 is actually part of the .NET 4.5 release. Anybody know for sure? I would love not to have to install MVC separately on my server. 回答1: No, ASP.NET MVC 4 is baked into VS2012, exactly the same way ASP.NET MVC 3 was baked into VS2010 but not part of .NET 4.0 (there was a separate download that you could install on your servers). But there will also be a separate download of ASP.NET MVC 4 for

HTTP HEAD request with HttpClient in .NET 4.5 and C#

a 夏天 提交于 2019-12-09 07:23:14
问题 Is it possible to create a HTTP HEAD request with the new HttpClient in .NET 4.5? The only methods I can find are GetAsync , DeleteAsync , PutAsync and PostAsync . I know that the HttpWebRequest -class is able to do that, but I want to use the modern HttpClient . 回答1: Use the SendAsync method with an instance of HttpRequestMessage that was constructed using HttpMethod.Head . GetAsync , PostAsync , etc are convenient wrappers around SendAsync ; the less common HTTP methods such as HEAD ,

Authenticating against AD FS from a .Net 4.5 Console App

*爱你&永不变心* 提交于 2019-12-09 06:51:05
问题 I'm in the process of getting my head round using AD FS to authenticate a user in a .NET 4.5 app. I can't find any examples of requesting/receiving the token from a console app and converting that token into a ClaimsPrinciple. The only examples I can find are WCF configuration based and I would really like to see the actual code that can do this in it's simplest form. I've installed AD FS and think I've got it configured ready to receive requests. I've created a relying party, given it a key

After upgrading solution to .NET framework 4.5 the daily deploy stopped working

老子叫甜甜 提交于 2019-12-09 06:07:20
问题 We have with success been updating our development web site at a daily basis using msdeploy from TFS2010. This was working fine until we upgraded to VS2012, our application from .NET Framework 4.0 to 4.5 and ASP.NET MVC from 3.0 to 4.0. It look like all is well and assemblies deployed but nothing has actually been deployed. I have been looking into this for two days now and can't figure out why this is happening and now I am running out of ideas. Below is part of my build script in the way it

How to use Task.WhenAll() correctly

自闭症网瘾萝莉.ら 提交于 2019-12-09 05:59:39
问题 I am trying to use Task.WhenAll to await completion of multiple tasks. My code is below - it is supposed to launch multiple async tasks, each of which retrieves a bus route and then adds them to a local array. However, Task.WhenAll(...) returns immediately, and the count of the local routes array is zero. This seems strange, since I would expect the various await statements within each Task to mean that the flow is suspended, and the Task does not return until it's finished. List<Task>

Forcing ASP.NET WebAPI client to send a client certificate even when no CA match

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 05:43:41
问题 I have a specific application that requires the use of client certificates for mutual authentication of HTTPS requests. The server has a flexible certificate validation policy that allows it to accept self-signed client certificates that are not present in the server's certificate store. This is known to work just fine using curl as a client. What I've determined via testing and packet sniffing is that Microsoft's ASP.NET HttpClient tries to be overly smart during the SSL handshake. This

RequestSecurityToken using windows credentials and .net 4.5 WIF

怎甘沉沦 提交于 2019-12-09 05:34:59
问题 Can anyone point to sample code for actively issuing a RequestSecurityToken using the NT credentials of the Thread.CurrentPrincipal as ClaimsPrincipal ? The scenario is an asp.net web app with windows authentication enabled (so there is an authenticated WindowsIdentity). My desire is to call the STS actively rather than enabling passiveRedirect, and to do this using the .Net 4.5 identity libraries. Most code samples, such as Claims Helper for Windows Phone or Using an Active STS set the