.net

Wcf service operation contract change

I recently added a parameter to one of the method of a wcf. It was a string parameter. The thing is that I didn't update the service reference on the client side but I was still able to call the wcf service ..... Wasn't it suppose to break? ...

ASP.NET MVC vs Winforms MVC

Why does MVC work so well in ASP.NET but not in (.NET) winforms? There isn't an explicit MVC for winforms offered from Microsoft. However, I see people attempting to use one but they are a bit of a mess compared to ASP.NET MVC. ...

How to recycle a IIS App Pool after a ServiceHost crash ?

Sometimes a ServiceHost -hosted on IIS- is faulted, so my service stop processing requests... Have you a solution to automatically recycle the app pool after such a crash ? Thanks, ...

Adding assembly reference requires base assembly to be referenced as well

I created a assembly having a child class that derives from a parent defined in another assembly. When I add reference to the child, Visula studio also requires reference to be added to the parent. Why is it so and how can I prevent it without losing any functionality? ...

How does MatchEvaluator works? ( C# regex replace)

This is the input string 23x * y34x2. I want to insert " * " (star surrounded by whitespaces) after every number followed by letter, and after every letter followed by number. So my input string would look like this: 23 * x * y * 34 * x * 2. This is the regex that does the job: @"\d(?=[a-z])|a-z". This is the function that I wrote that i...

Two questions on Singleton C#

Consider the following code public sealed class Singleton { private static readonly Singleton instance = new Singleton(); public static Singleton Instance { get { return instance; } } static Singleton() {} private Singleton() {} } Question 1) Here what is the purpose of static constructor ? (I know static cons...

Is there a way to get the raw SOAP request from within a ASP.NET WebMethod?

Example: public class Service1 : System.Web.Services.WebService { [WebMethod] public int Add(int x, int y) { string request = getRawSOAPRequest();//How could you implement this part? //.. do something with complete soap request int sum = x + y; return sum; } ...

Windows Service needs to wait, Thread.Sleep?

I have a c# windows service that needs to execute a database query every 60 seconds (or whatever interval is set in the config file). I'm using Thread.sleep(60) in a while loop to accomplish this. Is there a better way to do this? Thanks ...

Cannot connect to one of my WCF services, not even with telnet

I have six wcf services that I'm hosting in a windows service. Everything works great on my machine (Windows 7) (Edit: when hosted in Cassini, but not when running through the windows service) but when I try it in production (Windows Server 2003) I cannot connect to one of my six services, ReportsService. I figured I must have a typo...

Problem with creation of scheduled task from IIS6 on SR2003

Hi, I am writing a webapplication using .NET. The webapp creates scheduled tasks using the System.Diagnostics.Process class, calling SCHTASKS.EXE with parameters. I have changed the identity on the app pool, to a specific domain user. The domain-user is local administrator on all the four webservers. From webserver01 I am creating tas...

MRefBuilder invalid character exception on SandCastle

I'm trying to use the Sandcastle Help File Builder to generate a help file for my assembly. When I run the build I get the following error: MrefBuilder (v2.4.10520.1) Copyright c Microsoft 2006 Info: Loaded 1 assemblies for reflection and 15 dependency assemblies. Unhandled Exception: System.ArgumentException: '', hexadecimal va...

Linq-To-Sql with WCF, Models, and POCO ViewModels Disconnected "DataContext" Timestamp/Rowversion

I have a Linq-To-Sql based repository class which I have been successfully using. I am adding some functionality to the solution, which will provide WCF based access to the database. I have not exposed the generated Linq classes as DataContracts, I've instead created my own "ViewModel" as a POCO for each entity I am going to be returnin...

Open Source Graph Layout Library

I'm looking for an open source (GPL, LGPL etc) graph layout library for .net framework, preferably fully managed code. Im not worried about the visualisation aspect of things. I can find lots of them for Java, but none for .net... Thanks! ...

DateTime.Now within a statement

In the below thisIsAlwaysTrue should always be true. DateTime d = DateTime.Now; bool thisIsAlwaysTrue = d == d; But does DateTime.Now work in such a way that isThisAlwaysTrue is guaranteed to be true? Or can the clock change between references to the Now property? bool isThisAlwaysTrue = DateTime.Now == DateTime.Now; ...

Swap references at build time in VS

I have a project that runs on both .NET and .NET CF. But it uses a 3rd party library that will not run on both. So I end up changing the reference every time the project gets built. Project A - References the 3rd party dll. Project B - References A and runs .NET CF Project C - References A and runs .NET Is there a way to automate it?...

linq distinct field

how set distinct to this query return _dataContext.ProjectPictures.Include("Projects").Include("ProjectPictureTypes").Where(p => p.ProjectPictureTypes.Id == 1).ToList(); i need something like return _dataContext.ProjectPictures.Include("Projects").Include("ProjectPictureTypes").Where(p => p.ProjectPictureTypes.Id == 1).Distinct(p=>p...

Best pratice: How do I implement a list similar to Stackoverflow's Users List?

Technologies involved: ASP.NET Web-forms Javascript (jQuery for instance) Case To make it clearer let's give the Stackoverflow Users list as an example. This list can be manipulated at client-side. I can search, page and so forth. So obviously we would need to call jQuery.ajax to retrieve the HTML of each page given a search. Alrigh...

Server doesn't notice when client closes socket (.NET CF & GPRS)

Client written in .NET Compact Framework. Client connects a socket to the server over a GPRS connection. The server accepts the connection. Client sends 62 bytes of data and then closes the socket. Server never detects that the client has closed the socket and is therefore not able to know that the transfer has completed. This code ...

Serialize a C# class to xml. Store the XML as a string in SQL Server and then restore the class later

I want to serialize a class to xml and store that in a field in a database. I can serialize with this: StringWriter sw = new StringWriter(); XmlSerializer xmlser = new XmlSerializer(typeof(MyClass)); xmlser.Serialize(sw, myClassVariable); string s = sw.ToString(); sw.Close(); Thats works, but it has the namespaces in it. <.... xmln...

Relative Path To Absolute Path in VB .NET

Hi, I am writing a VB .NET console app where it spits takes relative path and spits out all file name, or error for invalid input. I am havinf trouble getting PhysicalPath from RelativePath Example: ` 1. I am in folder: C:\Documents and Settings\MehdiAnis.ULTIMATEBANGLA\My Documents\Visual Studio 2005\Projects\SP_Sol\SP_Proj\bin\Debug ...