Wednesday, July 14, 2010

ReportViewer not getting displayed on IIS7

Symptoms:
Unable to render ReportViewer on ASP.NET Web pages while running on IIS7.
You have no problem viewing your reports when running on debug mode with your Visual Studio 2005.
You are able to view your reports on Report Manager but not able to view them on IIS7.
You encounter JavaScript error when loading your report page with ReportViewer. Image buttons such as calendar appear as red 'X'.

Cause:
When the ReportViewer control is added to Web Form (.aspx), the
Reserved.ReportViewerWebControl.axd httpHandler is added to System.Web section of the Web.Config file. In IIS7, it should be added under System.Webserver section.
IIS7 Handler Mappings does not contain Reserved.ReportViewerWebControl.axd httpHandler, and therefore unable to render the ReportViewer elements needed by the JavaSript.

Applies to:
Internet Information Services 7.o (IIS7)
Microsoft Report Viewer Redistributable 2005

Resolution:
Open Internet Information Services (IIS) Manager and select your Web application.
Under IIS area, double-click on Handler Mappings icon.
At the Action pane on your right, click on Add Managed Handler.
At the Add Managed Handler dialog, enter the following:
Request path: Reserved.ReportViewerWebControl.axd
Type: Microsoft.Reporting.WebForms.HttpHandler
Name: Reserved-ReportViewerWebControl-axd
Click OK.

Reserved-ReportViewerWebControl-axd handler is now added to your Handler Mappings list. Notice that the following line has also been added to your Web.config file under the system.webserver's handler section:



Run your report now!




Tuesday, July 13, 2010

ASP.Net Menu control not working in IE 8. Hot fix.

Almost an year ago when i was struggling with ASP.Net menu controls which were not getting displayed properly on new aged browsers like Google Chrome and IE 8.0 there were no posts available on net in this regard. Though I could come out of Google Chrome's issue with ASP.Net Menu Control, IE 8.0 issue was left out as it is as my Customer was not at all upgraded to IE 8.0. Luckily I got my head out from it.

But today, if some one is in trouble on ASP.Net menu with IE 8.0, you have a hot fix file to be installed to get rid of the problems. Microsoft support Center accepted the issue in IE 8.0 and released a hot fix which available for free download. The Microsoft Knowledge Base Article details this issue. (Click on the link)

For Windows Vista and Windows Server 2008

For Windows XP and Windows Server 2003

A simple Web Service for the beginners; ASP.Net C#

WebService Method in App Code folder with a [WebMethod] attribute. Just a normal C# method with [WebMethod] attribute. @RecordCount is an output parameter returned by the stored procedure.

     [WebMethod]
    public static Int64 VerifyDuplicateActivation(Int64 DetailsId)
    {
        Int64 RecordsCount = 0;
        string connString = ConfigurationManager.AppSettings["DatabaseAnalyzeUAT1"].ToString();
        SqlConnection oConn = new SqlConnection(connString);
        SqlCommand oCommand = new SqlCommand();
        oCommand.Connection = oConn;
        oCommand.CommandText = "VerifyTeamActivation";
        oCommand.CommandType = CommandType.StoredProcedure;
        oCommand.Parameters.AddWithValue("@DetailsID", DetailsId);
        oCommand.Parameters.Add("@RecordCount", SqlDbType.BigInt);
        oCommand.Parameters["@RecordCount"].Direction = ParameterDirection.Output;
        oConn.Open();
        oCommand.ExecuteScalar();
        RecordsCount = (Int64)oCommand.Parameters["@RecordCount"].Value;
        return RecordsCount;
    }


Consuming WebService is just a method call if it is from Server Side.
Int64 RecCount = VerifyForDuplicate(details.DetailsId);

Wednesday, July 7, 2010

Patterns & Practices: Repository Factory for Data Access Creation

The Repository Factory is a guidance package that automates creation of entity classes that map to database tables and repository classes to read and write those entity classes. The generated code removes the tedium of writing a persistence-ignorant domain model.

The Repository Factory is not intended to be a be-all-does-everything ORM solution. Instead, it's a lightweight code generator that automates most of the hand-coding needed to build domain model object and persist them to a database

Download it Here

How to Create Data Access Layer in ASP.Net with Repository Factory

Never run ASP.NET Applications with debug=”true” enabled in Live Server

We, rarely bother about the settings in Web.Config file of our application when moving from Development environment to Production/Live.

has big impact on the performance of the Web Application/Site.

When debug is set to true, the following happens in the application scope.

1) Batch optimizations will be disabled and hence the compilation of pages takes longer
2) Some additional debug paths get enabled which causes for slower execution of code
3) More memory is used within the application at runtime
4) Scripts and images downloaded from the WebResources.axd handler are not cached

All client-javascript libraries and static images that are deployed via WebResources.axd will be continually downloaded by clients on each page view request and not cached locally within the browser.

When is set, the WebResource.axd handler will automatically set a long cache policy on resources retrieved via it – so that the resource is only downloaded once to the client and cached there forever

Sunday, May 30, 2010

Developing Custom Content Types for SharePoint

What could be a Content Type in SharePoint?

A content type is an object that is stored within MOSS that defines several elements of a piece of content, including:

  • Document Template that the content will be based on
  • Columns that the content will have associated with it (metadata)
  • Workflows that the content will use
  • Information Management policies that apply to the content
  • Conversion types for the content
Watch this wonderful video to learn about developing it with Visual Studio. Thanks to the author.





Monday, May 17, 2010

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID - MOSS

You may see this error in the EVENT VIEWER - more than once - when working with your Microsoft Office SharePoint Server (MOSS) 2007 deployment. This animal / error generally shows itself after you have applied an upgrade to an existing deployment. For example, when upgrading from B2 MOSS to B2TR MOSS - or when applying a special service pack from MSFT - you may begin to see a lot of these errors pop up in the SYSTEM event log.

The error CLSID is followed by a class ID for the DCOM+ application that the service account trying to activate that application - does NOT have permission to activate.

For example, let's say I installed MOSS on a server, and used the account mossService as the service account (a least privileged, user account you created to run the MOSS service(s))., when I get this error, I could very well see an error like the following:

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID

{61738644-F196-11D0-9953-00C04FD919C1}

to the user \mossService SID (S-1-5-21-). This security permission can be modified using the Component Services administrative tool.

Copy the GUID following the CLSID above, and go to REGEDIT

Start-->Run-->regedit

With the registry editor open, ensure that your cursor is on the computer at the beginning of the tree (make sure you are not in the middle of some previous edit session in the registry editor).

Edit-->Find and paste in the GUID. It'll stop at the application entry - and you will want to note the application name on the right side pane. In this example, it was the IIS WAMREG admin service that popped up.

Now, open Component Services from the server :-

Start-->Administrative Tools-->Component Services,

Expand Component Services, Computers, My Computer, DCOM Config. Scroll down and find the application (IIS WAMREG in this case).

Right-Click-->Properties and select the Security tab
.

You'll have some options here - the first block Launch and Activation Permissions - ensure that the
Customize radio button is selected, and click Edit. Now,

Add your service account - giving it launch and activate - and in some requirements - remote launch / activate permission.

Restart IIS and continue on.

NOTE: This solution is not specific to MOSS, i feel; hopefully this will help someone else who sees these annoying DCOM errors in WINDOWS EVENT LOG (EVENTVWR).