How do you know if WCF is installed on your machine or if WCF is registered with IIS ?
Run ServiceModelReg.exe from your command prompt with /i option to register/reregister WCF (.net 3.5) with your IIS.
Restart your IIS and then try rerun the service...hopefully this should work or atleast conifrm that you have your machine ready to execute WCF requests.
HTH - Dipesh
.NET architecture, programming tips and tricks around Microsoft technology stack - Azure, WCF Services, SQL and strategy work.
Wednesday, February 20, 2008
how do i deploy/host a WCF service on remote machine?
With the task completion of hosting WCF service on machine that has installed VS 2008 and now when you are ready to deploy this on remote machine in IIS this is what you do...
1> Publish web site (option with VS 2008) that generates compiled code,
2> Copy the files on your remote machine where you want this WCF service installed,
3> Create a virtual directory and point to the physical folder where .svc files are found.
That's it! :) It's pretty much similar to the traditional web services deployment.
before you install WCF serive on any machine ensure that you have WCF and IIS installed. (IIS 6 and above). WCF is part of .net 3.0 framework. it comes along with .net 3.5 redistributable package as well.
However, here are solutions to few issues you might encounter whilst deploying...
1> After deployment you get error "Service Unavailable" in IE.
Solution - Ensure that you have sufficent rights on the physical folder from where you are executing your service (.svc) ... specially asp_net and IIS workgroup users.
2> sometimes you may just get web configuration error as you launch WCF service in IE .svc ...
Solution - You may want to try specifying custom errors tag in web.config to have exceptions as "remoteonly" so that you can understand the unhandled exceptions thrown by IIS. Sometimes, this just solves the problem...atleast solved for me :)
Previous posts on WCF - http://archdipesh.blogspot.com/search/label/WCF
Cheers - Dipesh
1> Publish web site (option with VS 2008) that generates compiled code,
2> Copy the files on your remote machine where you want this WCF service installed,
3> Create a virtual directory and point to the physical folder where .svc files are found.
That's it! :) It's pretty much similar to the traditional web services deployment.
before you install WCF serive on any machine ensure that you have WCF and IIS installed. (IIS 6 and above). WCF is part of .net 3.0 framework. it comes along with .net 3.5 redistributable package as well.
However, here are solutions to few issues you might encounter whilst deploying...
1> After deployment you get error "Service Unavailable" in IE.
Solution - Ensure that you have sufficent rights on the physical folder from where you are executing your service (.svc) ... specially asp_net and IIS workgroup users.
2> sometimes you may just get web configuration error as you launch WCF service in IE .svc ...
Solution - You may want to try specifying custom errors tag in web.config to have exceptions as "remoteonly" so that you can understand the unhandled exceptions thrown by IIS. Sometimes, this just solves the problem...atleast solved for me :)
Previous posts on WCF - http://archdipesh.blogspot.com/search/label/WCF
Cheers - Dipesh
Overcome slow performance with the initial WCF service load/call
So now when you are all set with "WCF service" deployment milestone :) do you experience slow performance on the initial call/load of the WCF service?
Yes, Scott mentioned in the .net roadmap one of the points of cold warmup perfomance fix this summer....till then Joel has this post which has attached warmup script files that overcomes this problem.
Refer his post to get attachments -
http://blogs.msdn.com/joelo/archive/2006/08/13/697044.aspx
HTH- Dipesh
Yes, Scott mentioned in the .net roadmap one of the points of cold warmup perfomance fix this summer....till then Joel has this post which has attached warmup script files that overcomes this problem.
Refer his post to get attachments -
http://blogs.msdn.com/joelo/archive/2006/08/13/697044.aspx
HTH- Dipesh
Tuesday, February 19, 2008
Scott Gu's roadmap for .net 3.5
Congratulations to Scott Guthrie first on his new role and responsibilities... he is the man! :) btw, he is on a roll with his product roadmap of .net 3.5 this summer.
You can see details on his blog here but for sure some of these changes are huge, such as speeding up cold load of .NET applications by 25%-40%, improving WPF support...and so on.
Check this - http://weblogs.asp.net/scottgu/archive/2008/02/19/net-3-5-client-product-roadmap.aspx
Cheers - Dipesh
You can see details on his blog here but for sure some of these changes are huge, such as speeding up cold load of .NET applications by 25%-40%, improving WPF support...and so on.
Check this - http://weblogs.asp.net/scottgu/archive/2008/02/19/net-3-5-client-product-roadmap.aspx
Cheers - Dipesh
Convert existing asmx .net web service to WCF service in .net 3.0/3.5
If you are thinking what if i already have an existing web service .asmx which are exposed to existing clients already but still want to use the new technology infrastructure then you can do it really sweet. (why you would do that...must check new features of WCF on msdn:))
So if you have existing web service like this - http://mycompany/myWebservice.asmx
Steps to have clients use .asmx extension but behind scenes use powerful WCF here they are -
1> Decorate web service class name and web method with ServiceContract and OperationContract atrributes. For this you should add reference System.ServiceModel.dll assembly that is part of .net 3.5 framework. You can download .net 3.5 framework from to have WCF services run on your machines just fine.
Once you install you should found this installed in GAC.
here's how it looks-
using System.ServiceModel;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ServiceContract(Namespace="http://tempuri.org")]
public class myWebService : System.Web.Services.WebService
{
[WebMethod]
[OperationContract]
public string HelloWorld(string name)
{
return string.Format("Hello, {0}",name);
}
}
2> add this system.serviceModel section into your existing web.config of the asmx web service -

3> you can run the web service now and it should compile and run without issues with asmx extension but one more thing you would have to do to tell .net runtime to use WCF service runtime is add buildprovider under Compilation section.

4> Last but not the least modify your markup code .asmx to have something like this -% @ServiceHost language = "c#" Service="yourNamespace.ClassnameOftheService" %
This shuold help you up and running WCF service still keeping the existing asmx extension!
If you are done ...great! After i completed all the above steps i encountered pretty wierd errors saying -
Service 'myWebservice' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
Reason - that was because my web.config had wrong endpoint service name reference.
service name="myWebService" behaviorConfiguration="returnFaults"
endpoint binding="basicHttpBinding" contract="myWebService"
Rectifying that helped...
If you still continue to get error you may also want to verify that you have your config file as web.config instead of app.config.
Hope that helps!
Here are few links for further information and references used here -
http://blogs.msdn.com/wenlong/archive/2007/09/18/how-to-use-asmx-extension-to-handle-wcf-requests.aspx
http://www.topxml.com/rbnews/WSCF/WCF/re-44738_Phased-Migration-From-ASMX-to-WCF.aspx
For more on WCF visit previous posts here - http://archdipesh.blogspot.com/search/label/WCF
Cheers - Dipesh
So if you have existing web service like this - http://mycompany/myWebservice.asmx
Steps to have clients use .asmx extension but behind scenes use powerful WCF here they are -
1> Decorate web service class name and web method with ServiceContract and OperationContract atrributes. For this you should add reference System.ServiceModel.dll assembly that is part of .net 3.5 framework. You can download .net 3.5 framework from to have WCF services run on your machines just fine.
Once you install you should found this installed in GAC.
here's how it looks-
using System.ServiceModel;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ServiceContract(Namespace="http://tempuri.org")]
public class myWebService : System.Web.Services.WebService
{
[WebMethod]
[OperationContract]
public string HelloWorld(string name)
{
return string.Format("Hello, {0}",name);
}
}
2> add this system.serviceModel section into your existing web.config of the asmx web service -
3> you can run the web service now and it should compile and run without issues with asmx extension but one more thing you would have to do to tell .net runtime to use WCF service runtime is add buildprovider under Compilation section.
4> Last but not the least modify your markup code .asmx to have something like this -% @ServiceHost language = "c#" Service="yourNamespace.ClassnameOftheService" %
This shuold help you up and running WCF service still keeping the existing asmx extension!
If you are done ...great! After i completed all the above steps i encountered pretty wierd errors saying -
Service 'myWebservice' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
Reason - that was because my web.config had wrong endpoint service name reference.
service name="myWebService" behaviorConfiguration="returnFaults"
endpoint binding="basicHttpBinding" contract="myWebService"
Rectifying that helped...
If you still continue to get error you may also want to verify that you have your config file as web.config instead of app.config.
Hope that helps!
Here are few links for further information and references used here -
http://blogs.msdn.com/wenlong/archive/2007/09/18/how-to-use-asmx-extension-to-handle-wcf-requests.aspx
http://www.topxml.com/rbnews/WSCF/WCF/re-44738_Phased-Migration-From-ASMX-to-WCF.aspx
For more on WCF visit previous posts here - http://archdipesh.blogspot.com/search/label/WCF
Cheers - Dipesh
No Web methods visible in WCF service hosted...workaround
Well, one real good thing that i liked about WCF is the ease by which you get a new WCF service running real quick. The best part is that Microsoft has provided a code template with sample methods and contracts in VS 2008. You just hit Run button and you are good to go. However, with such ease i had few problems that i ran into. First of all i started creating a WCF web service project under Web which is pretty similar to ASMX style of coding. I am still to figure out why Microsoft has provided an option to create an WCF service library (a dll for web service...huh!) Regardless, if you just run the WCF service first time ...don't be afraid if you see NONE of your web methods listed in IE for the WCF service you just created. That's by nature...ofcourse there are workarounds by which you can intercept client messages inbound and outbound. Keith has showed us a way by which you can see your web methods and actually inspect soap body and envelope going through your client.
http://keithelder.net/blog/archive/2008/01/15/How-to-Get-Around-WCFs-Lack-of-a-Preview-Web.aspx
intial post on how to start writing your own WCF service and concepts look at this video on my previous post - http://archdipesh.blogspot.com/2007/12/creating-service-with-windows.html
HTH- Dipesh
http://keithelder.net/blog/archive/2008/01/15/How-to-Get-Around-WCFs-Lack-of-a-Preview-Web.aspx
intial post on how to start writing your own WCF service and concepts look at this video on my previous post - http://archdipesh.blogspot.com/2007/12/creating-service-with-windows.html
HTH- Dipesh
Wednesday, February 13, 2008
How to post xml file or any other file onto server through .net web services?
I was in Dallas last week and working on a release of which i was not supposed to be part of it initially and then working on a Silverlight contest (still working.) btw, you too can take part in the Silverlight contest by Microsoft here -
http://silverlight.net/Showcase/
Regardless, working little bit more on web services i figured that it is absolutely ok to pass XMl as a set of string data through .net web service.
Also, i found this interesting simple article on how to upload XML or for that matter any file onto server - http://www.c-sharpcorner.com/UploadFile/scottlysle/UploadwithCSharpWS05032007121259PM/UploadwithCSharpWS.aspx
HTH, Thanks - Dipesh
http://silverlight.net/Showcase/
Regardless, working little bit more on web services i figured that it is absolutely ok to pass XMl as a set of string data through .net web service.
Also, i found this interesting simple article on how to upload XML or for that matter any file onto server - http://www.c-sharpcorner.com/UploadFile/scottlysle/UploadwithCSharpWS05032007121259PM/UploadwithCSharpWS.aspx
HTH, Thanks - Dipesh
Calling .net web service through HTTP Post
Below are the steps how you would call a web service from .net code through HTTP POST -
Dim oXmlhttpCaller as Object;
' Create Object of MSXml2.XMLHTTP
Set oXmlhttpCaller = Server.CreateObject("Msxml2.XMLHTTP")
'oXmlhttpCaller.open "GET","http://localhost/HelloWorld/Service.asmx/HelloWorldWit'hCustomMessage?s_msg= Hope you like this article.", False
oXmlhttpCaller.open "POST","http://localhost/HelloWorld/Service.asmx/
HelloWorldWithCustomMessage", False
oXmlhttpCaller.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXmlhttpCaller.send("Msg= Hello World!")
HTH, in my next post i wiill try and show how to send XML message as part of your input paramter. Thanks - Dj
Dim oXmlhttpCaller as Object;
' Create Object of MSXml2.XMLHTTP
Set oXmlhttpCaller = Server.CreateObject("Msxml2.XMLHTTP")
'oXmlhttpCaller.open "GET","http://localhost/HelloWorld/Service.asmx/HelloWorldWit'hCustomMessage?s_msg= Hope you like this article.", False
oXmlhttpCaller.open "POST","http://localhost/HelloWorld/Service.asmx/
HelloWorldWithCustomMessage", False
oXmlhttpCaller.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oXmlhttpCaller.send("Msg= Hello World!")
HTH, in my next post i wiill try and show how to send XML message as part of your input paramter. Thanks - Dj
CRM 4.0 VPC (Virtual machine download)
Here's the latest Microsoft Dynamics CRM 4.0 (Titan) complete Virtual Machine
http://www.microsoft.com/downloads/details.aspx?FamilyID=dd939ed9-87a5-4c13-b212-a922cc02b469&DisplayLang=en
This VPC is a one computer setup with Microsoft Dynamics CRM 4.0 and associated Microsoft Dynamics CRM clients for Microsoft Office Outlook and Microsoft Internet Explorer.
This demonstration also contains Microsoft SQL Server 2005, Microsoft Visual Studio 2005, Microsoft Office Communications Server and client, Microsoft SharePoint services, and Microsoft PerformancePoint Server 2007. Full details about the image are included in the virtual machine itself.
This virtual machine will expire in April, 2009. Cheers - D
http://www.microsoft.com/downloads/details.aspx?FamilyID=dd939ed9-87a5-4c13-b212-a922cc02b469&DisplayLang=en
This VPC is a one computer setup with Microsoft Dynamics CRM 4.0 and associated Microsoft Dynamics CRM clients for Microsoft Office Outlook and Microsoft Internet Explorer.
This demonstration also contains Microsoft SQL Server 2005, Microsoft Visual Studio 2005, Microsoft Office Communications Server and client, Microsoft SharePoint services, and Microsoft PerformancePoint Server 2007. Full details about the image are included in the virtual machine itself.
This virtual machine will expire in April, 2009. Cheers - D
Friday, February 01, 2008
sample .net code gallery at code.msdn
Find tons of sample .net (C#, WCF, LINQ...) and others available now at MSDN code gallery - http://code.msdn.microsoft.com/
Cheers - Dipesh
Cheers - Dipesh
Sunday, January 27, 2008
CRM java scripting
There are plenty of javascript good sites, here's one specific to CRM java scripting: http://www.stunnware.com/crm2/topic.aspx?id=JS4
Wednesday, January 23, 2008
.net interview questions
Preparing for .net interview to face soon? or planning to take net interview? Find Scott Hanselman's post on .net interview questions here -
http://www.hanselman.com/blog/WhatGreatNETDevelopersOughtToKnowMoreNETInterviewQuestions.aspx
HL - Dipesh
http://www.hanselman.com/blog/WhatGreatNETDevelopersOughtToKnowMoreNETInterviewQuestions.aspx
HL - Dipesh
Thursday, January 17, 2008
Debug .net source code through Visual Studio 2008
With the news of open source code for Visual Studio 2008 now available i was wondering how do you achieve this and i ran into this quite detailed article by Shawn here - http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx
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
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
If you are experiencing 401 error - "The request failed with HTTP status 401: Unauthorized" while inserting/updating a record in CRM database through CRM web service .create or .update method even when you can access the CRM web service/meta web service through browser (IE) then you may want to probably check your "manage network password" of your windows login account. Control Panel -> Users -> User name -> Manage network password and add the server IP (where CRM web service is hosted) with correct credentials if required or if you changed your network password then try updaing your password in here as well. Stop the current process run and try running/accessing the CRM web service insert/update and it should work fine. HTH, - Dipesh
Tuesday, January 15, 2008
Code assessment and code metrics through Visual Studio 2008 and third party tools!
If you are planning to assess your old application code and generate code statistics (lines of code, complexity, etc.) then here are some tools that may help:
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
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
Tool that would allow you to rename schema name can be found as Mscrmrenameattributes.exe along with CRM 3.0 rollup update install. Unfortunately, i am not sure if Microsoft provides this as a seperate one.
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
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...
If you want to SFTP (secure connect) through .net here's the code that helps you achieve that using CuteFTPPro as below. If you want to compare with other options available in the market follow the link below. HTH,
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
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
If you are faced with the web service error while invoking the service from remote machine, by default, it would display the message "The test form is only available for requests from the local machine."
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
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 MSDN subscriber, you can download your VS 2008 copy from the MSDN subscription site - http://msdn2.microsoft.com/subscriptions
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
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
In my search of doing my job faster in the development of web services i found this pretty helpful tool: WSCF - Web Services Contract First. This helps us generating .net code (C#, vb.net) from WSDL, XSD and so on. You can generate proxy classes for .net/java or any other client and also .net web service - server side code all 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
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
Mike has posted a nice article that helps one achieve faster web service performance by compressing SOAP. Read here - http://www.dotnetjunkies.com/Article/46630AE2-1C79-4D5F-827E-6C2857FF1D23.dcik
You may want to peek at Microsoft's article as well - http://msdn2.microsoft.com/en-us/library/s25h0swd.aspx
Hope that helps. - DJ
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?
If you want to compress string before passing it over the network to save bandwidth or uncompress it back here is the code for the same. It usese freeware NZIPLIB library. You can download the source code and compiled assembly from this site. Download now!
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;
}
}
}
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
If you read my previous post http://archdipesh.blogspot.com/2008/01/xml-xsdexe-usage-tips.html you may be good if you are using a simple XSD file (no nesting). But if i have multiple XSD files and they are all nested then there is a problem! Using XSD.exe tool doesn't help and fails for nested schema files.
It seems XSD.exe doesn’t seem to recognizeelement when generating code file...and it spits out the error ... "Class generation failed, cannot recognize root element". If you are facing the same error remove imports element from the XSD just include the namespace and try specifying multiple XSD file names from the command line while executing xsd.exe tool.
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
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
Here are few quick tips that can help you understand and start with XML basics...
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
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
Subscribe to:
Posts (Atom)