Naveed Akhtar

Nothing will work unless you do -- Maya Angelou
Microsoft Dynamics CRM 2011 / 4.0 Configuration in Case of Machine rename / CRM Database server change / Domain Controller Change

Dears, I had wierd issue while running MS CRM 2011 after I changed the machine name. I would like to share the configurations with you that I did for my case and hope that it will be helpful for you too.

First of all, let me explain what kind of errors you will get on machine name / domain controller changes,

  • CRM deployment Manger will give exception
  • Record not found when you try to open  crm url in explorer
  • Server ID not found

The solution is simple but need DBA assistance on changes... please take backup of the MS CRM conguration Database and Windows registry.

 I have divided the steps in to two sections.

  • The registry changes,
  • The Database changes

Registry Changes

  1. go to RUN then execute regedit to open the windows registry
  2. go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM
    • you will find two key that needs to be change
    • configdb, it is database connection string where CRM configuration DB is there. you need to change the databse server name in that key.

Data Source=YourDBServerName;Initial Catalog=MSCRM_CONFIG;Integrated Security=SSPI

    • ServerUrl, it is the CRM service url. you need to chnage the server name here also.

http://YourServerName:5555/MSCRMServices

That all for the first step.

Database Changes

  1. Open the database server with the user which has access to the CRM configuation database "MSCRM_CONFIG"
  2. Open the query editor in that database and run the following queries.

UPDATE

ConfigSettings

SET

[HelpServerUrl] = 'http://YourServerName:5555/'

2.

UPDATE

Organization

SET

[ConnectionString] = 'Provider=SQLOLEDB;Data Source=YourDatabaseServerName;Initial Catalog=YourOrganizationDatabase;Integrated Security=SSPI',

[SqlServerName]

= 'YourDatabaseServerName',

[SrsUrl]

= 'http://YourReportingServerName/reportserver'

3.

UPDATE

[Server]

SET

[Name] = 'YourServerName'

Please note that I am assuming the you have only one instance of CRM installed in your organization Database server otherwise, you need to add WHERE clause with related primary IDs.

Thats all and you are done with the configurations. you can check the CRM in browser like

 http://YourServerName:5555/

 I hope this article will be helpful for you.

 Thanks,

Working with ASP.Net Webservice on Vista / Windows Server 2008 (IIS 7)

Working with Web services on Window 2003 Server (IIS 6) doesn't occured any effects when moving from windows XP.

Hmm, But on moving to windows vista / windows 2008 Server, I was quite confused with the big change that Microsoft have done for existing ASP.Net applications.

What the Problem is? Please see the screenshot...

 

Error on Windows 2008

Surprised?? I was too. But after some searching and references, I got the solution for that.

 Solution

Go to the Internet information Service Manager ,

Start-> Administrative Tools -> Internet Information Services (IIS) Manager (or type inetmgr in run dialog)

Now, on the left side, expand the Server, then Expand the Sites and then Expand the Default WebSite (for my case its default) as shown blow

Solution Part 1 

Now, right click on the site (my case application) and then Manage Application -> Advanced Settings as shown,

 Solution Part 2

 

 There, you will get the Application Pool Setting so change the setting as shown below

Solution Part 3 

Press OK, and then try again in you browser,

YOUR PROBLEM IS SOLVED....

Solution Part 4

Any Questions / Problem, please contact.

Regards,

Naveed Akhtar.

kick it on DotNetKicks.com

Converting Data Table / Dataset Into JSON String

JSON (Java Script Object Notation), is a light weight, easily understandable to read and write string. It is also easily parse-able by machine.

JSON is introduced on two structues

A collection (key/value pair)

And ordered list of values.

I have not covered this topic in detail. Detailed analysis is stated on http://www.json.org/.

I am presenting a helper function (in C#) for developers for fast parsing on datatable / dataset into JSON String, and access it on client-side.

public static string GetJSONString(DataTable Dt)

{

string[] StrDc = new string[Dt.Columns.Count];

string HeadStr = string.Empty;

for (int i = 0; i < Dt.Columns.Count; i++)

{

StrDc[i] = Dt.Columns[i].Caption;

HeadStr +=
"\"" + StrDc[i] + "\" : \"" + StrDc[i] + i.ToString() + "¾" + "\",";

}

HeadStr = HeadStr.Substring(0, HeadStr.Length - 1);

StringBuilder Sb = new StringBuilder();

Sb.Append("{\"" + Dt.TableName + "\" : [");

for (int i = 0; i < Dt.Rows.Count; i++)

{

string TempStr = HeadStr;

Sb.Append("{");

for (int j = 0; j < Dt.Columns.Count; j++)

{

TempStr = TempStr.Replace(Dt.Columns[j] + j.ToString() + "¾", Dt.Rows[i][j].ToString());

}

Sb.Append(TempStr +
"},");

}

Sb =
new StringBuilder(Sb.ToString().Substring(0, Sb.ToString().Length - 1));

Sb.Append("]}");

return Sb.ToString();

}

Here, Dt is the datatable, and it returns JSON formatted string.

For detailed porcedure on how to access this string on client side, please refer to this link Exposing Webservices to Client-Side because I don't like to do task repetition.

Please donot forget to convert to JSON string to JSON Object using

var JObject = eval('(' + JSONString + ');');

in Javascript JObject have all characteristics of JSON object, through which you can Use JObject by iterrating or what so ever.

e.g., you can use your JObject as

for(var i = 0; i < JObject .Employees.length; i++)

{

var val1 = JObject.Employees[i].EmployeeID;

var val2 = JObject.Employees[i].NationalIDNumber;

var val3 = JObject.Employees[i].Title;

var val4 = JObject.Employees[i].BirthDate;

var val5 = JObject .Employees[i].HireDate ;

}

Please note that I am querieng data from AdventurWorksDB SQL Sample Database (Table: Employee).

I hope this article will be helpful for you.

Any Questions / Queries ??

Regards,

Naveed Akhtar

kick it on DotNetKicks.com

ASP.Net Compilation and Merge Tool (Part 2 of 2)
ASP NET Merge tool allows user to manage and combine assemblies that are created using ASP NET Compilation tool. It works only on assemblies that have been created by using ASP.NET 2.0 or higher.This tool creates one assembly for each folder in target application or it creates each assembly for each file.This tool gives you additional functionality for management and deployment. It allows user to do the following operations.Create single assembly for just single web application UI elements such as controls and pagesCreate assembly for whole web applicationCreate assembly for each web application and affix to assembly name

Syntax

aspnet_merge     [-?]     //  -? displays command syntax

applicationPath

[-keyfile filename [-delaysign]] 

[-o assemblyname | -w assemblyname | -prefix prefix]

[-copyattrs [assemblyfile]]

[-debug]

[-nologo]

[-errorstack]

[-r]

[-xmldocs]

[-a]

[-logfile logfile]

[-allowattrs textfile]

Example

The command stated below merges the assemblies of the precompiled site in the C:\PreCompSite directory.

Aspnet_merge C:\ PreCompSite
The command stated below merges assemblies of a precompiled web application in the C:\ PreCompSite directory and signs the merged assemblies by using the KFile.snk file. The merged application will have one assembly for each precompiled application folder.
Aspnet_merge C:\ PreCompSite -keyfile KFile.snk
The command stated below merges all assemblies of the precompiled site in the C:\ PreCompSite directory into a single assembly and names the resulting assembly MyWebApplication.dll. The merged site will have one assembly for all Web site UI content.
Aspnet_merge C:\ PreCompSite -w MyWebApplication.dll
The command stated below merges all assemblies of the precompiled site in the C:\ PreCompSite directory into a single assembly and names the resulting assembly MyWebApplication.dll.
Aspnet_merge C:\ PreCompSite -o MyWebApplication.dll
Why to Use Aspnet_merge tool

Please refer to my previous post ASP.Net Compilation and Merge Tool (Part 1 of 2) for advantages.

kick it on DotNetKicks.com

ASP.Net Compilation and Merge Tool (Part 1 of 2)

ASP.NET Compilation tool is used to compile an ASP.NET Web application either in same machine or to deploy on a target machine such as a production server. It helps application performance because end users do not encounter a delay on the first request to the application while the application is compiled on backend.

 

Compilation for deployment can be in one or two ways

  • That removes all files such as code-behind and markup files
  • That retains markup files.
 Syntax

aspnet_compiler  [-?]

                 [-m metabasePath | -v virtualPath [-p physicalPath]]

                 [[-u] [-f] [-d] [-fixednames] targetDir]

                 [-c]

                 [-errorstack]

                 [-nologo]

                 [[-keyfile file | -keycontainer container ] [-aptca] [-delaysign]]

 

Example

Aspnet_compiler -v /WebApp1 -p "c:\MyProjects\WebApp1" -keyfile "c:\MyProjects\KeyWebApp1.sn" -aptca c:\applicationTarget

Why to use ASP.Net Compilation Tool 

People always ask, why I use ASP.Net Compilation tool. The answer is “precompiled ASP.Net 2.0 Web Application”. Following are the advantages to use ASP.Net Compilation and Merge Tool. According to MSDN

 
  • Security
  • Performance
  • Stability
 Security

Pre-compilation of ASP.Net Application slow down reverse engineering process, because it lacks the abstraction and readability of a high-level language.

 Performance

Compiled code faster than other scripting languages such as VBScript or ECMAScript because it is a closer to machine code and does not need additional parsing.

 Stability

Code is checked on compilation for syntax, type safety and other sort of problems by caching error at build process and then you can eliminate these errors.

  kick it on DotNetKicks.com
How to use Javascript using Server-side scripting

Hi.
This article is interesting for those who loves to use javascript, but with little server postbacks. I had some times issues related to validation or client redirection or other sorts. So i got this solution and i would like to share it with you.
Here I am presenting a scenario. I have a button, and OnClick of this button, i want to call java script function.

On Server Side (.aspx.cs)
--------------------------
Write this code under Button_Click event or in any server event.

ClientScript.RegisterStartupScript(this.GetType(), "key", "SubmitConfirm();",true);

You can also pass server control, properties to the "SubmitConfirm();" function.

On Client Side (.aspx)
--------------------------
write within javascript tag

function SubmitConfirm()

{

  alert('Form Submitted and Information Sent to naveedmcp@yahoo.com');

  window.location='TestPage.aspx';

}
-------------------------------------

kick it on DotNetKicks.com

More Posts