.NET architecture, programming tips and tricks around Microsoft technology stack - Azure, WCF Services, SQL and strategy work.
Friday, February 01, 2008
Sunday, January 27, 2008
CRM java scripting
Wednesday, January 23, 2008
.net interview questions
http://www.hanselman.com/blog/WhatGreatNETDevelopersOughtToKnowMoreNETInterviewQuestions.aspx
HL - Dipesh
Thursday, January 17, 2008
Debug .net source code through Visual Studio 2008
As of date .net assemblies that are currently available as open source or for symbol/source loading where developers can actually step into VS .net source code are:-
Mscorlib.DLL
System.DLL
System.Data.DLL
System.Drawing.DLL
System.Web.DLL
System.Web.Extensions.DLL
System.Windows.Forms.DLL
System.XML.DLL
WPF (UIAutomation*.dll, System.Windows.DLL, System.Printing.DLL, System.Speech.DLL, WindowsBase.DLL, WindowsFormsIntegration.DLL, Presentation*.dll, some others)
Microsoft.VisualBasic.DLL
I believe more will follow! happy debugging... Regards - Dipesh
Wednesday, January 16, 2008
HTTP 401 Unauthorized error while inserting/updating through CRM web service
Tuesday, January 15, 2008
Code assessment and code metrics through Visual Studio 2008 and third party tools!
nDepend - http://www.ndepend.com/Features.aspx
Reflector has code metrics - http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=CodeMetrics
Visual Studio 2008 can generate code metrics too:
http://blogs.msdn.com/fxcop/archive/2007/10/03/new-for-visual-studio-2008-code-metrics.aspx
Also, find CCFinderX that bring us another point of view in code analysis for .net and non .net code - http://www.ccfinder.net/ccfinderx.html
CRM 3.0 rollup 2 download and fixes
Key issues that are fixed in Update Rollup 2 for Microsoft Dynamics CRM 3.0
918990 (http://support.microsoft.com/kb/918990/) You experience timeouts or slow performance after you change a security role or after you import a customization file in Microsoft Dynamics CRM 3.0
920135 (http://support.microsoft.com/kb/920135/) Error message when you try to import a customization into Microsoft Dynamics CRM 3.0: "The selected customization file does not conform to the required customization file schema"
920859 (http://support.microsoft.com/kb/920859/) Error message when you send an e-mail message in Microsoft Dynamics CRM 3.0: "You do not have enough privileges to access the Microsoft CRM Object or perform the requested operation"
921065 (http://support.microsoft.com/kb/921065/) Internet Information Services stops responding on a Microsoft Dynamics CRM 3.0 server
921235 (http://support.microsoft.com/kb/921235/) You experience timeouts or slow performance when you reassign records from one user to another user in Microsoft Dynamics CRM 3.0
923281 (http://support.microsoft.com/kb/923281/) The client stops responding when you try to go offline or to run the "Synchronize Outlook with CRM" function in Microsoft Dynamics CRM client for Outlook
925437 (http://support.microsoft.com/kb/925437/) Error message when you send an e-mail message from the Microsoft Dynamics CRM 3.0 Web client: "Insufficient Permissions"
925505 (http://support.microsoft.com/kb/925505/) Microsoft Outlook stops responding when you click a command button on the Microsoft Dynamics CRM toolbar
925874 (http://support.microsoft.com/kb/925874/) An update for the 2007 daylight saving time changes is available for Microsoft Dynamics CRM 3.0 and for the Microsoft Dynamics CRM 3.0 client for Outlook
928272 (http://support.microsoft.com/kb/928272/) Outlook exits unexpectedly when you click "Go Offline" in the Microsoft Dynamics CRM laptop client for Outlook
929488 (http://support.microsoft.com/kb/929488/) Error message when you attach a .docx file to a record in Microsoft Dynamics CRM 3.0: "File Upload Failure"
931270 (http://support.microsoft.com/kb/931270/) Error message when you use the Microsoft Dynamics CRM client for Microsoft Office Outlook: "Microsoft Office Outlook has encountered a problem and needs to close. We are sorry for the inconvenience"
932984 (http://support.microsoft.com/kb/932984/) How to make the 2007 daylight saving time changes by using the Update Time Zones Wizard for Microsoft Dynamics CRM 3.0
for details visit - http://support.microsoft.com/default.aspx?kbid=927751
Download rollup 2 update for MS CRM 3.0 server here -
* CRM3.0-KB927751-Server-ENU.exe package - http://www.microsoft.com/downloads/details.aspx?FamilyId=81674DA5-FFEF-492A-A7B1-7E1F1951B05F
Download CRM 3.0 client for Microsoft Office Outlook here -
* CRM3.0-KB927751-Client-ENU.exe package - http://www.microsoft.com/downloads/details.aspx?FamilyId=81674DA5-FFEF-492A-A7B1-7E1F1951B05F
Secure FTP connect through .net + other tools...
public void SecureFTPConnect()
{
.....
// Open the SFTP connection
Sftp = new CuteFTPPro.TEConnectionClass();
Sftp.Host = ServerName;
Sftp.Protocol = Protocol;
Sftp.Port = PortNumber;
Sftp.Login = UserName;
Sftp.Password = Password;
Sftp.MaxConnections = 1;
Sftp.Retries = 0;
Sftp.TransferType = "ASCII";
//Connect to SFTP location
Sftp.Connect();
}
Check few more SFTP (SSH File Transfer Protocol) components for .NET (C#, VB.NET) here - http://www.eldos.com/sbb/sftpcompare.php
Thanks - DJ
Thursday, January 10, 2008
Calling web services from remote machines easy way: Test environment
Add this piece of section in your web.config to enable your web service to be invoked from remote machines,
Add the following settings to the Web.Config file of the Web Service -
(XML start << and >> signs are not visible...dont know how to do that with this blogger editor!)
system.web
webservices
protocols
add name="HttpGet"
add name="HttpPost"
/protocols
/webservices>
/SYSTEM.WEB
This would enable the Web service to be able to be invoked from remote machine. This setting would only be useful in development / testing scenarios and it is advisable to remove /comment the above section when releasing for production, due to security reasons.
HTH - DJ
Wednesday, January 09, 2008
Download Visual Studio 2008 (complete software or Virtual machine)
If you are a non-MSDN subscriber, you can download a 90-day free trial edition of Visual Studio 2008 Team Suite here -
90-Day Trial Downloads
Visual Studio 2008 Professional Edition (smaller in size)
Visual Studio Team System 2008 Team Suite
Visual Studio Team System 2008 Team Foundation Server
Visual Studio Team System 2008 Test Load Agent
If you want to use the free Visual Studio 2008 Express editions (which are much smaller and totally free), you can download them here.
If you want to just install the .NET Framework 3.5 runtime, you can download it here.
If you are looking for Virtual Machine (VPC) with Visual Studio 2008 Installed for You then check here -
Visual Studio Team System 2008 Team Suite with Visual Studio Team System 2008 Team Foundation Server
Visual Studio Team System 2008 Team Foundation Server with Team Explorer
To use these virtual machines, you must have either Virtual PC 2007 or Virtual Server 2005 R2 SP1.
If you want free MSDN library it is avaialble for download here - http://go.microsoft.com/?linkid=7947400
To help you jump start with new features with VS 2008 you can download free Visual Studio ebook here - http://go.microsoft.com/?linkid=8010142
Keep watching this blog if you are interested in exploring new features on VS 2008 apart from this ebook. Happy exploring! Cheers - Dipesh
Tuesday, January 08, 2008
Generate code from WSDL/XSD from Visual Studio 2005
You can find the latest version here- http://www.thinktecture.com/media/7478/wscf0.7.zip
You can find the walkthrough document here - http://www.thinktecture.com/resourcearchive/tools-and-software/wscf/wscf-walkthrough
Thanks - Dipesh
Friday, January 04, 2008
Improve web service performance
You may want to peek at Microsoft's article as well - http://msdn2.microsoft.com/en-us/library/s25h0swd.aspx
Hope that helps. - DJ
How to compress/uncompress string in .net before passing it over the network?
using System;
using NZlib.GZip;
using NZlib.Compression;
using NZlib.Streams;
using System.IO;
using System.Net;
using System.Runtime.Serialization;
using System.Xml;
namespace zipper
{
public class MyClass
{
public static string Compress(string uncompressedString)
{
byte[] bytData = System.Text.Encoding.UTF8.GetBytes(uncompressedString);
MemoryStream ms = new MemoryStream();
Stream s = new DeflaterOutputStream(ms);
s.Write(bytData, 0, bytData.Length);
s.Close();
byte[] compressedData = (byte[])ms.ToArray();
return System.Convert.ToBase64String(compressedData, 0, _
compressedData.Length);
}
public static string DeCompress(string compressedString)
{
string uncompressedString="";
int totalLength = 0;
byte[] bytInput = System.Convert.FromBase64String(compressedString);;
byte[] writeData = new byte[4096];
Stream s2 = new InflaterInputStream(new MemoryStream(bytInput));
while (true)
{
int size = s2.Read(writeData, 0, writeData.Length);
if (size > 0)
{
totalLength += size;
uncompressedString+=System.Text.Encoding.UTF8.GetString(writeData, _
0, size);
}
else
{
break;
}
}
s2.Close();
return uncompressedString;
}
}
}
Wednesday, January 02, 2008
XSDObjectGen - nested schema (imports) error with XSD.exe tool
It seems XSD.exe doesn’t seem to recognize
OR ... sweet way would be to look at XSDObjectGen tool. This is pretty exhaustive and can handle imports/mutiple xsd files easily. (though one level down). This code can then be used as a class exposed by web services.
Download Sample Code generator from here - http://www.microsoft.com/downloads/details.aspx?familyid=89e6b1e5-f66c-4a4d-933b-46222bb01eb0&displaylang=en
Saves lot of time and pain for sure! HTH, Thanks - Dipesh
XML, XSD.exe usage tips
Questions - (preferably in this sequence)
How do you generate XSD ?
You need to have a valid XML file for which you want to have a schema generated ( XSD)
If you have VS .net you can just open the xml file into VS.net and then under XML menu you should see "Create Schema" option that should generate an .xsd file for you!
How do you create classes from an XSD schema?
You can create .net (C#, VB, J#) source code from the xsd using XSD tool (command line) along with MS .net framework.
http://samples.gotdotnet.com/quickstart/howto/doc/xmlserialization/xsdtocls.aspx
How do you convert (deserialize) XML into an object that you can read through .net code?
AND
How do you write out an XML file (serialize) from an object through .net code?
http://samples.gotdotnet.com/quickstart/howto/doc/xmlserialization/rwobjfromxml.aspx
Thats simple ...is it? Thanks - Dipesh
How do i authenticate web service requests before invoking web methods ?
How do i authenticate the web service request before invoking web methods ?
There are several ways to do this and one of the most easiest way is to pass user name, password as input parameters to web method called. but na, that is not a good way to implement as this information is at the periphery of the core business functionality of the web service exposed. Hence keeping this out makes more sense.
Another way to control anonymous access can be achieved through IIS (web server) settings. Just uncheck the anonymous access or limit the IPs that can hit your web services or validate it against your windows account group... but again you may want to implement partial anonymous access! Few web methods can be accessed by everyone, few have restricted access.
In that case, better way to do this is to pass this information into SOAP header (SOAP web services communicate through SOAP messages - which include SOAP envelope (inc. namespace and root element), SOAP Header (this is optional) and SOAP body (contains web method, input parameters and response result)
Working with SOAP Headers in order to have a Web service accept a SOAP header we need to perform the following three tasks:
1> Define a SOAP header class in the Web service project
public class AuthenticationHeader : SoapHeader
{
public string Username;
public string Password;
}
2> Add a public member variable of the SOAP header class created in step (1) to the Web service class
[WebService(Namespace=http://www.comp.com/yournamespace )]
public class MyWebService : System.Web.Services.WebService
{
public AuthenticationHeader AuthHeader;
... The Web service's methods would be defined down here ...
}
3> Add the SoapHeader attribute to the Web method(s) that need to be able to programmatically access the value of the header
Once we perform these three steps at the Web service's end, our next task is to configure the client so that it can invoke a Web service method and pass along data for the appropriate SOAP header(s). The first step, as we've discussed in earlier installments of this article series, is to create a proxy class on the client. This will auto-generate the SOAP header class defined in the Web service project and will add a public property to the proxy class through which an instance of the SOAP header can be affixed to outgoing messages.
To actually pass along a populated SOAP header when calling a Web method the client needs to first create an instance of the proxy's SOAP header class, populate its values, and then assign this header class instance to the appropriate proxy class property. Finally, calling one of the Web service's methods will invoke the method, passing along the SOAP header.
[WebMethod(), SoapHeader("AuthHeader")]
public string GetMessage()
{
// Only allow valid user/password to access this secret message...
if (AuthHeader.Username == "user" && AuthHeader.Password == "password")
return "This is the secret message!!!";
else
return "YOU ARE NOT AUTHORIZED TO SEE THIS MESSAGE!";
}
In order to send a SOAP header to the Web service method, the client should do the following:
1> Create an instance of the proxy class,
2> Create an instance of the SOAP header class and populate its values,
3> Affix the SOAP header to the proxy class by assigning the SOAP header class instance created in step (2) to the proxy class's AuthHeaderValue property, and, finally
4> Call the Web service method
The following code illustrates these four steps. The GetMessage() Web method is invoked from the client passing along a username/password pair of scott and password.
// step 1, create the proxy class
localhost.MyWebService proxy = new localhost.MyWebService();
// step 2, create and populate the header class
localhost.AuthenticationHeader authInfo = new localhost.AuthenticationHeader();
authInfo.Username = "user";
authInfo.Password = "password";
// step 3, affix the SOAP header to the proxy
proxy.AuthHeaderValue = authInfo;
// step 4, call the method
string result = proxy.GetMessage();
The value returned from GetMessage() will contain the appropriate message, based on the username/password sent via the SOAP header.
Conclusion - If you want to know more or learn real sweet about the whole web services or SOAP basics and details visit Scott Mitchell's article on http://aspnet.4guysfromrolla.com/articles/123103-1.aspx. He has written 11 part series about .net web services. Hope that helps! Thanks - Dipesh
XML Serialization: what can be XML serialized and what cannot be ?
Realize that XML serialization:
1> XML serialization can only be applied to classes that contain a public default (parameterless) constructor. If you create a class in the Web service that does not have a public default constructor, the Web service will still compile, but when attempting to generate the proxy class on the client's end you'll receive an error message.
2> Read-only class properties are NOT serialized. That is, if a property in the class has only a get accessor, and not a set accessor as well, the property will not be serialized.
3> ONLY public properties and fields are serialized. Private properties are not serialized.
4> To serialize a strongly-typed collection of objects, have the class derived from System.Collections.CollectionBase adding an Add() method and an indexer.
Alternatively you can send an array of the specified type.
On the last point, consider the case where you want a Web service method to accept a set of custom class instances. For example, imagine you wanted to build a Web method that accepted a number of instances of type CreditCardInfo. One option is to have the method accept an array of type CreditCardInfo, like so:
[WebMethod()]
public void FooBar(CreditCardInfo [] collectionOfCCInfos)
{
...
}
Another option is to create a strongly-typed collection class derived from System.Collections.CollectionBase. You'd then pass in an instance of this strongly-typed collection class. For example, you'd first create the class:
public class CreditCardInfoCollection : System.Collections.CollectionBase
{
public void Add(CreditCardInfo cc)
{
this.InnerList.Add(cc);
}
public CreditCardInfo this[int index]
{
get { return (CreditCardInfo) this.InnerList[index]; }
set { this.InnerList[index] = value; }
}
}
And then you'd have the Web service method accept an input of this strongly-typed collection class:
[WebMethod()]
public void FooBar(CreditCardInfoCollection collectionOfCCInfos)
{
...
}
See this article for more details on web services and XML related basics...
http://aspnet.4guysfromrolla.com/articles/121703-1.aspx
btw, Happy New Year 2008 :)
Happy programming - DJ
Friday, December 28, 2007
Creating service with Windows Communication Foundation(WCF) - video
http://weblogs.asp.net/dwahlin/archive/2007/02/03/video-creating-a-service-with-windows-communication-service-wcf.aspx
Also, visit Dan Wahlin's blog to see more illustrations, samples and video tutorials here - http://weblogs.asp.net/dwahlin/archive/tags/WCF/default.aspx
Happy learning WCF!
- DJ
CRM 4.0 SDK
Happy learning and Happy New Year! Cheers - DJ
Monday, December 17, 2007
CRM 4.0 (Titan) Overview
View here - http://channel9.msdn.com/showpost.aspx?postid=356796
Happy learning - Dipesh
CRM 4.0 Data Import
New CRM 4.0 Data Import -
Microsoft offers multiple options to import data into your CRM implementation. It used to have in CRM 3.0 as well but with the Release of Titan there are multiple options to explore as listed:
Bulk Import Wizard - The Bulk Import Wizard has been improved in Microsoft Dynamics CRM 4.0. The list of entities to import has been extended with almost all system entities as well as custom entities. Also, the mappings created between the source data and the CRM system can now be saved and reused in subsequent import activities. Another new feature is the ability to see the list of imported records after the import has succeeded. Based on this list actions can be executed like Quick Campaigns and even deleting the records if necessary. The last major improvement is the ability to enrich data which is already in the system.
Data Migration Framework (3.0)/ Manager (4.0) - The second tool which Microsoft offers is the Data Migration Framework. This tool can be used to import data if any of the following scenarios do apply:
A> Migrate data from multiple sources
B> There are records which are related to others within the same or another entity
C> Notes and / or attachments need to be migrated
D> Data needs to be cleansed before importing into the CRM system
There are several third party tools that can do the job as well if this out of box functionality provided by MS does not fit your bill.
CRM Extensions / c360: ImportManager - http://www.c360.com/ImportManager.aspx
Scribe TOOL (my favourite, you should look into this if you need both ways data conversion - into CRM and from CRM to external interfaces!) - http://www.scribesoftware.com/microsoft-dynamics-crm.asp
For additional information visit Ronald's blog - he is the man :) Cheers - Dipesh
Understanding what is best for you ..differences between VPC and Vmware
What you need - VPC or VmWare ?
No matter what your needs, it is very likely that either VMware or Virtual PC/Server can do the job. The key to choosing the right product is understanding your needs. What is it that you want to do with virtualization? Do you want to have a test network on your desktop PC? Do you want to do software development? How many servers will you run concurrently? What operating systems will be run in the virtual systems? The answers to these questions will help you choose the right virtualization product!
Choosing the right product -Once you take a look at your needs, you will be able to better choose the product you need. For example, if you just want to run a test on Windows XP workstation or 2003 server on your local desktop, then you should choose a desktop virtualization product. Examples of these are - VMware Workstation(300$ odd) and MS Virtual PC(free). Both of those applications are designed to be run on a local desktop.
On the other hand, if you need to run more than 1 concurrent servers that required at least 1GB of RAM each, you are no longer talking about a desktop product. You require an enterprise virtualization server product! Not only because of the amount of RAM required but because we said that we would run “multiple servers”. You don’t want to run them on desktop virtualization products.
For further information or understanding their pros and cons refer - http://www.petri.co.il/virtual_vmware_virtualpc_compared.htm
To download Vmware visit - http://www.vmware.com/
To download microsoft VPC 2007 visit - http://www.microsoft.com/downloads/details.aspx?FamilyId=04D26402-3199-48A3-AFA2-2DC0B40A73B6
Thanks - Dipesh
Monday, November 19, 2007
Visual Studio 2008 and .Net Framework 3.5 release...
http://www.news.com/8301-10784_3-9820007-7.html?part=rss&subj=news&tag=2547-1_3-0-5
Monday, November 05, 2007
Browse CRM entities through CRM browser...
It should be something like - http://
…/SDK/lists.aspx
(where … is the root address to your crm web app)
Cheers - Dipesh
Microsoft Commits to November Release Date for Visual Studio 2008 and the .NET Framework 3.5
Today, during the keynote address at Microsoft TechEd Developers 2007, S. “Soma” Somasegar, corporate vice president of the Developer Division at Microsoft Corp., announced that Microsoft will release Visual Studio 2008 and the .NET Framework 3.5 by the end of November 2007.... more
http://www.microsoft.com/presspass/press/2007/nov07/11-05TechEdDevelopersPR.mspx
Cheers - Dipesh