.net-4.5

SqlClient.SqlException: The wait operation timed out

我的未来我决定 提交于 2019-12-08 04:19:56
问题 I'm currently trying to create a large amount of test data with numerous insert statements using code similar to below... using (var connection = new SqlConnection(_connectionString)) { using (var command = new SqlCommand(query.ToString(), connection)) { try { connection.Open(); command.ExecuteNonQuery(); return true; } catch (Exception e) { ...... } } } My problem is that I keep getting an error The wait operation timed out and yet when I run the SQL statement that failed from within SQL

ClickOnce WPF application not running on Windows 7 64-bit

点点圈 提交于 2019-12-08 03:49:23
问题 I have a ClickOnce (C#, WPF, .NET 4.5) application, it runs and works fine under Windows 7 32-bit. It is compiled as Any CPU . Under Windows 7 64-bit I see the ClickOnce start screen, and then nothing happens (no errors, nothing obvious). In order to debug, I have copied the EXE file and all relevant DLL files into one directory. I started from there: Again same situation, it runs under Windows 7 32-bit, but nothing happens under Windows 7 64-bit. I have crosschecked with a "clean" Windows 7

How do you style WebView control in Windows Store App?

*爱你&永不变心* 提交于 2019-12-08 03:38:10
问题 I have C# / XAML win store app which receives various data from json. one piece of it - html string. I display that string using WebView.NavigateToString However I don't see how can I style it. Normally I would use blend to get default style and then edit it. But Blend doesn't let me style WebView. I ended up wrapping the json html into <body style='background-color:black;color:white' /> but this approach doesn't let me use theming which the rest of the application does. What is the 'proper'

Configure Service Reference… - Object reference is not set to an instance of an object

六眼飞鱼酱① 提交于 2019-12-08 02:56:42
问题 I am working with Visual Studio 2013 , .NET4.5 . Originally I was WCF service consumer but due to lack of resources in team that deals with subsystem I took over development of both sides of WCF service. So I got Code of the WCF service that I need to call and now trying to plug it in to debug it on my local system. Issue: Service that I need to call works on localhost fine I can get wsdl and browse to it. However when I try in Visual Studio 2013 'Configure Service Reference...' and Try to

Why does this code fail when executed via TPL/Tasks?

倖福魔咒の 提交于 2019-12-08 02:09:53
问题 I am using System.Net.Http to use network resources. When running on a single thread it works perfectly. When I run the code via TPL, it hangs and never completes until the timeout is hit. What happens is that all the threads end up waiting on the sendTask.Result line. I am not sure what they are waiting on, but I assume it is something in HttpClient. The networking code is: using (var request = new HttpRequestMessage(HttpMethod.Get, "http://google.com/")) { using (var client = new HttpClient

Visual Studio 2012: Can I start a .NET 4.5 application in a remote debugger (and not only attach)?

倾然丶 夕夏残阳落幕 提交于 2019-12-08 02:08:06
问题 Platform: * Visual Studio 2012 * C# WPF application * Visual Studio 2012 remote debugger tools. My .NET 4.5 application on a 64-bit system crashes at an very early stage. I have the Visual Studio 2012 remote debugging running on the (remote) 64-bit system. I can connect from my development computer with Visual Studio 2012, all fine. My problem is that I need to attach to a process in order to remotely debug. Before I can attach to the process, the application has crashed. Basically I want to

Is it possible to serialize a list of System.Object objects using protocol buffers

青春壹個敷衍的年華 提交于 2019-12-08 01:59:47
问题 I have a list of objects of various data types (DateTime, int, decimal, string). List<object> myObjects = new List<object>(); myObjects.Add(3); myObjects.Add(3.9m); myObjects.Add(DateTime.Now); myObjects.Add("HELLO"); I was able to serialize this list using protobuf-net, but deserialization always throws the exception: "Additional information: Type is not expected, and no contract can be inferred: System.Object". using (var ms = new MemoryStream()) { Serializer.Serialize(ms, list2); var bytes

Entity Framework: Store entity property in json format

浪尽此生 提交于 2019-12-08 01:46:43
问题 Let's say you've an entity that has a property typed as ICollection<string> and I want to store it as varchar in SQL Server in JSON format. How to achieve this? Thank you in advance. 回答1: Probably You should have another string property in your Model class to hold the JSON represntation of the Collection of string. and that property will be mapped to your Table. Do not map the Collection property to your Table. Something like this public class Customer { public int ID { set;get;} public

Get Type by Name

大憨熊 提交于 2019-12-08 01:24:26
In my code I am trying to get a type by name. When I was using a string argument I failed. Then I have tried to do the follwing in the Quick watch window: Type.GetType(typeof(System.ServiceModel.NetNamedPipeBinding).Name) returns null. Why? and how to get the desired type by name? Type.GetType can only find types in mscorlib or current assembly when you pass namespace qualified name. To make it work you need "AssemblyQualifiedName". The assembly-qualified name of the type to get. See AssemblyQualifiedName. If the type is in the currently executing assembly or in Mscorlib.dll, it is sufficient

Setting the “Windows Security” dialog owner during a Client Certificate involving SslStream.AuthenticateAsClient()

梦想的初衷 提交于 2019-12-08 00:44:29
问题 Some background first Upon calling SslStream.AuthenticateAsClient() to initiate TLS/SSL handshake, the user can be presented with this following "Windows Security" dialog: Windows security: This application needs to use a cryptographic key This happens when both these following reasons are met: The SSL server to which the client is attempting to connect to requested a client certificate as part of the TLS/SSL handshake. The X509Certificate passed via the second argument of SslStream