Wednesday, March 13, 2013

CommunicationException from wcf service

My wcf service takes xml as an input param. It fails when I try passing huge xmls to it but works for smaller ones. Following is the error I get when I try processing through the big xmls.
 

The adapter failed to transmit message going to send port "abcservice" with URL "abc.svc". It will be retransmitted after the retry interval specified for this Send Port. Details:"System.ServiceModel.CommunicationException: An error occurred while receiving the HTTP response to abc.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)

   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)

   --- End of inner exception stack trace ---

   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)

   at System.Net.PooledStream.EndRead(IAsyncResult asyncResult)

   at System.Net.Connection.ReadCallback(IAsyncResult asyncResult)

   --- End of inner exception stack trace ---

   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)

   --- End of inner exception stack trace ---

I found the resolution to this is:
Adding maxRequestLength to System.web to change the default setting
 <httpRuntime maxRequestLength="16384" /> . Default value for this is 4MB  
If you do not already find the <htttpRuntime> in your config add one .
maxRequestLength="16384" (means 16MB since 1MB = 1024 kb)
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="16384" />
</system.web>

 

Wednesday, February 13, 2013

Parameter is not valid - System.Drawing.Image.FromStream

Two cases when you get this error:
1. When the stream is of 0 length or null
2. When the stream you are trying to save as image is not actually an image, like for eg: I have the stream of a pdf file received from a service and I am trying to convert this to an image.

 

Tuesday, February 5, 2013

System.Net.WebException: The request failed with HTTP status 403: Forbidden.

I found a web service failing with this error on the prod box.

I found following is the issue that caused this
Execute permission on the virtual directory of the service is set to none, where it should be set to 'ScriptsOnly'.
I set this back to 'ScriptsOnly' and the service started working
I do not need to do an iisreset

Tuesday, October 9, 2012

Dtexec error: The version number in the package is not val. Package migration from version 6 to version 3 failed with errorid


Error: I got the following error when I tried executing SSIS package from dtexec.

Microsoft (R) SQL Server Execute Package Utility

Version 10.0.2531.0 for 64-bit

Copyright (C) Microsoft Corp 1984-2005. All rights reserved.

Started: 8:10:18 AM

Error: 2012-10-10 08:10:18.97

Code: 0xC001700A

Source:

Description: The version number in the package is not valid. The version numb

er cannot be greater than current version number.

End Error

Error: 2012-10-10 08:10:18.98

Code: 0xC0016020

Source:

Description: Package migration from version 6 to version 3 failed with error

0xC001700A "The version number in the package is not valid. The version number c

annot be greater than current version number.".

End Error

Error: 2012-10-10 08:10:18.98

Code: 0xC0010018

Source:

Description: Error loading value "<DTS:Property xmlns:DTS="www.microsoft.com/

SqlServer/Dts" DTS:Name="PackageFormatVersion">6</DTS:Property>" from node "DTS:

Property".

End Error

Could not load package "ExecuteSql_Sample.dtsx" because of error 0xC0010014.

Description: The package failed to load due to error 0xC0010014 "One or more err

or occurred. There should be more specific errors preceding this one that explai

ns the details of the errors. This message is used as a return value from functi

ons that encounter errors.". This occurs when CPackage::LoadFromXML fails.

Source:

 

Solution:

This error happened because I developed the package using SqlServerDataTools (BIDS of 2012) and the error shows it is trying to downgrade to a lower version

Solution for this is to execute the dtsexec from the version that you developed it with. In my case it is Sql Server 2012, so the path of the dtexec that you need to use is C:\Program Files\Microsoft SQL Server\110\DTS\Binn. You can update the Path environment variable to move this to the foremost among other dtexec paths

Sunday, October 7, 2012

Properties window BackUp Database SSIS

Today while trying to refresh my knowledge on SSIS, I tried creating a sample SSIS package with 'BackUp Database' task

One silly issue that I encountered is when I open up the properties window of the task, I find that the buttons at the bottom to finish setting properties is exceeding the screen size and the buttons are getting hidden below the task bar, on my new 18.5 inch LED.

I tried to check whether there is a way out to resize or move the window but no, I can't. So I had to do this. Hide your task bar and now click on the buttons to finish your configuration.

How you hide the task bar: Right click on task bar -> Select properties -> Uncheck lock taskbar & check the Auto-hide the task bar -> Apply -> OK. Now you should be able to click on your buttons and complete configuration for the Back database task.

I agree I could do this by resetting my screen resolution which I do not want to do, as I am quite comfortable with my current one. Hope Microsoft provides a resizable window in the next version of SQL Server data tools (BIDs earlier) :)

Saturday, October 6, 2012

Package fails validation

If your package does not execute and you find the following errors in validation of package, it is that you are trying to execute a the package on 64-bit machine, which is not supported for some of the SSIS tasks like ExcelSource and Excel Destination


[Excel Destination [23]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0209303.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.
[SSIS.Pipeline] Error: Excel Destination failed validation and returned error code 0xC020801C.
[Connection manager "Excel Connection Manager"] Error: The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode. Error code: 0x00000000.
An OLE DB record is available.  Source: "Microsoft OLE DB Service Components"  Hresult: 0x80040154  Description: "Class not registered".


Resolution:
You can execute the package in 32-bit at the Progress tab suggests. For this go to Project Menu -> Select <Project> properties -> Configuration properties ->Debugging -> Debug Options -> Run64bitRuntime. By default this option is true on a 64-bit machine. Set this to false.

I found this link more helpful

Saturday, September 29, 2012

Set build order for projects in a solution

From the properties of the solution select depedencies and for each project in your solution you specify the dependent projects. Once you specify the dependencies VisualStudio would set the build order automatically for you.