Saturday, November 14, 2009

Error "The username is not provided. Specify username in ClientCredentials."

Issue:
Error "The username is not provided. Specify username in ClientCredentials." while calling secured web service "HTTPS".

Cause:
Actually there're three causes with my application:
  1. Security mode was not appropriae.
  2. Client credential type was not appropriate.
  3. The call missed passing the required Username and Passwoed.

Solution:

The solution was in setting the apporpiate security mode, client credentials type and passing the required username and password.

  1. Set the appropriate Security mode in the configuration file (app.config OR web.config),it's should be "Transport":
security mode="Transport"


  1. Set the appropriate client credential type in the configuration file (app.config OR web.config),it's should be "Basic":

transport clientcredentialtype="Basic"

  1. Pass the required username and password:

proxy.ClientCredentials.UserName.UserName = "xyz";
proxy.ClientCredentials.UserName.Password = "123";

Ahmed A.Moneim

Thursday, December 18, 2008

SSIS runtime de-round Numbers

Issue: I have very strange issue with package that transofm data from excel file to text file, the issue that if there's a value in the excel with decimal point ends with .12345 it transformed to text file to .123449999999998. actuall all the sequence numbers less than or equal 5 drop the same issue.
for examble if we have the below value in the excel:
22.12345 it transfomed to 22.123449999999998 in the text file, i put i dataviewer after the excel data source and everything seems alright, the data type of the source columns are double precision.

Cause: Unknown, i communicated with one developer from SSIS team and he tried to troupleshoot the problem with me, but the cause is still unknows.

Wrok Around solution:


put a data conversion before the destination, and convert the type to decimal with only 5 scale.


Monday, December 1, 2008

Backup DB error

Problem: i create a deployment project for a windows application, this setup will install SQL Server express edition before installing the application, after installing the application and when the user trying to backup the DB using the application it gave me the below error
"Cannot open backup device 'C:\backupname.bak'. Operating system error 5(error not found).BACKUP DATABASE is terminating abnormally." and the only location i can create the backup is "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup".

Cause: becaue the SQL Server Express Service run under account "Local Syetm Network".

Resolution:

1. Go to "My Computer" ==> "Control Panel" ==> "Administrative Tools".

2. Open "Services".

3. Locate Service with name "SQL Server (SQLEXPRESS)" and Open it.

4. Choose "Log On" tab.

5. then select "Local System Account".

6. Press "OK".

7. Right Click on the service.

8. Choose Restart.

Created By
Ahmed Abdel Moneim

Monday, November 3, 2008

Birt Reporting Tool

I will document all my experience with Birt reporting tool:
Some facts about Birt - Birt is a reporting tool integrated with Java. - Birt saves the report design in xml format. - There's a lot of APIs come with Birt used to integrate with Birt to develop custom designer or custom engine. - Birt very primitive reporting tool with limited out of the box features, but it include a lot of APIs make it extensible.
Where to start? - You need Eclipse IDE to with Birt plug-ins , and you can download it from the URL below: http://www.eclipse.org/downloads/download.php?file=/birt/downloads/drops/R-R1-2_3_1-200809221151/birt-report-designer-all-in-one-2_3_1.zip
- Download the Birt Runtime Engine from: http://www.eclipse.org/downloads/download.php?file=/birt/downloads/drops/R-R1-2_3_1-200809221151/birt-runtime-2_3_1.zip And extract it to: C:/birt-runtime-2_3_1/
- Then you should extract this file.
- Now you can open Eclipse IDE and design you first report.
- There’s a very useful tutorial on Eclipse site to design simple Birt report: http://www.eclipse.org/birt/phoenix/tutorial/basic/
Integration Examples
- I found very useful examples that demonstrate the integration points and capabilities with Birt runtime engine.
1. Java – Simple Design Engine http://wiki.eclipse.org/Java_-_Simple_Design_Engine_API_%28BIRT%29
this example show how to develop a custom report designer.
When you go through this example don’t forget the below: a. Make sure that Eclipse reference to the correct JDK: Window => Preferences ==>Java==>Installed JREs Window ==> Preferences ==>Java==>Compiler
b. Make sure that your project reference the Birt packages Right click your project ==> Properties ==> Java Build Path==>libraries. If there’s any exception fire to you try to add from “Add External JARs” I add reference to the below JARs: o eclipse/plugins/com.ibm.icu_3.8.1.v20080530.jar o eclipse/plugins/org.eclipse.birt.report.model_2.3.1.v20080912.jar" o eclipse/plugins/org.eclipse.birt.report.runtime_2.3.1.v20080701.jar o eclipse/plugins/org.eclipse.birt.core.ui_2.3.1.v20080807.jar o eclipse/plugins/org.eclipse.birt.core_2.3.1.v20080912.jar o eclipse/plugins/org.eclipse.birt.report.designer.core_2.3.1.v20080911.jar o eclipse/plugins/org.eclipse.birt.report.designer_2.3.1.v20080701.jar o eclipse/plugins/org.apache.commons.codec_1.3.0.v20080530-1600.jar o eclipse/plugins/org.eclipse.birt.data_2.3.1.v20080829.jar o eclipse/plugins/org.w3c.css.sac_1.3.0.v200805290154.jar o eclipse/plugins/org.mozilla.rhino_1.6.7.v20080214/lib/js.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/chartengineapi.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/com.ibm.icu_3.8.1.v20080530.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/commons-cli-1.0.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/coreapi.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/crosstabcoreapi.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/dataadapterapi.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/dataaggregationapi.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/dataextraction.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/dteapi.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/engineapi.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/flute.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/js.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/modelapi.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/modelodaapi.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/odadesignapi.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/org.apache.commons.codec_1.3.0.v20080530-1600.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/org.eclipse.emf.common_2.4.0.v200808251517.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/org.eclipse.emf.ecore.xmi_2.4.1.v200808251517.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/org.eclipse.emf.ecore_2.4.1.v200808251517.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/org.w3c.css.sac_1.3.0.v200805290154.jar o C:/birt-runtime-2_3_1/ReportEngine/lib/scriptapi.jar o eclipse/plugins/org.apache.derby.core_10.3.1.4/derby.jar
c. don’t forget to change this code line in the class sample to reference the Birt runtime engine: config.setProperty("BIRT_HOME", "C:/birt-runtime-2_1_1/birt-runtime-2_1_1/ReportEngine"); Replace it to config.setProperty("BIRT_HOME", "C:/birt-runtime-2_3_1//ReportEngine");
d. create this folder on C root to because the sample render the generated report inside this folder c:/tmp/
e. Now you can run the sample. Enjoy ;)
2. Java - Execute Modified Report (BIRT) http://wiki.eclipse.org/Java_-_Execute_Modified_Report_%28BIRT%29
This example show how to execute existing report and generate data report with any format (HTML, pdf … etc)
3. Using the BIRT Report Viewer http://www.eclipse.org/birt/phoenix/deploy/viewerSetup.php
This example show how to use the report viewer, it works with me only when I install Apache web server 5.5: http://tomcat.apache.org/download-55.cgi

Conclusion: - You can modify the existing reports designed with Eclipse IDE or by editing the report XML file (but don’t forget to take a backup before editing J) - You can get the report result by: o By executing the existing report through Birt APIs. o Run the report directly through a JSP application. o Use the report viewer in a JSP or PHP application. - You can build your own designer or engine by using the APIs.

Created By

Ahmed Abdel Moneim

Sunday, November 2, 2008

Java - Simple Design Engine API (BIRT)

Error: When try to run the java application that use the Birt APIs it gave the below error:
org.eclipse.birt.core.exception.BirtException: Cant startup the OSGI framework
at org.eclipse.birt.core.framework.Platform.startup(Platform.java:91)
at DECreateDynamicTable.buildReport(DECreateDynamicTable.java:109)
at DECreateDynamicTable.main(DECreateDynamicTable.java:45)
Caused by: org.eclipse.birt.core.exception.BirtException: Could not start the Framework - C:/birt-runtime-2_1_1/birt-runtime-2_1_1/ReportEngine
at org.eclipse.birt.core.framework.osgi.OSGILauncher.startup(OSGILauncher.java:87)
at org.eclipse.birt.core.framework.Platform.startup(Platform.java:79)
... 2 more
Exception in thread "main" java.lang.NullPointerException
at DECreateDynamicTable.buildReport(DECreateDynamicTable.java:119)
at DECreateDynamicTable.main(DECreateDynamicTable.java:45)


Cause: because the Birt_Home variable in configration object not refer to the Birt Engine Path correctly.

Resolution: Locate the below code line and correct the path
config.setProperty("BIRT_HOME", "C:/birt-runtime-2_3_1/ReportEngine");


Created By
Ahmed Abdel Moneim

Sunday, October 19, 2008

Publish Orchestration as web Service Problem

Issue# 6
Error: after publishing the orchestration ports as a web service, the result from the orchestration should be multiple records, but the web service return only the first record.


Cause: because the schema of the response port missing the “minOccurs="1" and maxOccurs=”unbounded””, to tell the web service generator that the data returned from this operation will be multiple records (array).

Resolution: set these properties in the final result schema.

Created by
Ahmed Abdel Moneim

Submit Message to BAS Problem

"You receive a "Destination party not found" error message when you try to run the scenario in module 3 of the "Partner Management and Business Activity Monitoring" tutorial in BizTalk Server 2004
View products that this article applies to.
Article ID : 896311
Last Review : September 24, 2007
Revision : 2.4
SYMPTOMS
In Microsoft BizTalk Server 2004, when you try to run the scenario in module 3 of the "Partner Management and Business Activity Monitoring" tutorial, you receive the following error message:
OrderProcess.OrderService(65270963-3dea-9fe0-fcd4-20547da7368e), instance 0c36eaf3-94e2-4198-8809-3a1225eeef74 Destination party not found while attempting to send message 'MinPOAmountRequestMsg' to (s-1-5-7, OrganizationName).

Exception type: DestinationPartyNotFoundException

Exception from HRESULT: 0xC0C01665.
"


Cause:
This issue occurs when the Logon property of the BizTalkServerIsolatedHost host is set to \UserAccount instead of LocalComputerName\UserAccount. BizTalkServerIsolatedHost is the default isolated BizTalk Server host.

This issue may occur when you run the BizTalk Server 2004 Configuration Wizard to set up BizTalk Server 2004 to run on a single computer. By default, when you run the Configuration Wizard, the Configuration Wizard creates the appropriate BizTalk Server group accounts for you. However, the Configuration Wizard may incorrectly set the Logon property of the BizTalk Server host to \UserAccount instead of LocalComputerName\UserAccount.

Note The Logon property of the host may also be set to a valid domain account. For example, the Logon property may be set to DomainName\UserAccount.
Back to the top

RESOLUTION:
To resolve this issue, you must set the Logon property of the BizTalkServerIsolatedHost host to LocalComputerName\UserAccount. To do this, follow these steps: 1. Click Start, click All Programs, click Microsoft BizTalk Server 2004, and then click BizTalk Server Administration.
2. In the BizTalk Server Administration Console, expand Microsoft BizTalk Server 2004 (local), expand Hosts, and then click BizTalkServerIsolatedHost.
3. In the result pane, right-click your local computer name, and then click Properties.
4. In the Properties dialog box, click Change.
5. In the Provide account information dialog box, type LocalComputerName\UserAccount in the Logon box.

Note Replace LocalComputerName with your local computer name and replace UserAccount with your local user account name.
6. In the Password box, type your local user account password, and then click OK two times.
Note After you set the Logon property to the correct local user account name, you must restart the BizTalk Server service.

Also Applies to 2006

Created by
Ahmed Abdel Moneim - I found it on Microsoft sub site.

Configure BAS in BizTalk 2006



Issue #4
Problem: when trying to register BizTalk server to the BAS to associate the BizTalk Management database with the BAS Web site and create a receive location for the BAS outbox, it gave me the below error:
"Failed to create the BizTalk registration for the BizTalk Server named, 'D0E6D8987F4E458'.
Could not store transport type data for Primary Transport of Send Port 'Bas.TpmWebServicePort' to config store. Primary SSO Server 'D0E6D8987F4E458' failed. Cannot perform encryption or decryption because the secret is not available from the master secret server. See the event log (on computer 'D0E6D8987F4E458') for related errors."




Reason: After reinstalling BTS 2006, I connect the SSO to the existing DB and SSO create new secret file, so the SSO refer to secret file not exist.




Resolution:
1. BizTalk backup the secret file in this path: “C:\Program Files\Common Files\Enterprise Single Sign-On”. With file extension .bak
2. Open SSO Administration console, exist in the same path ”C:\Program Files\Common Files\Enterprise Single Sign-On\ ENTSSO.msc”
3. Choose “System” from the right Pane.
4. From menu choose ActionsèRestore Secret.




5. Then browse for the key backup and type the password:
Example for the password “The SSO backup file password is the current password of Administrator as of Wed, 10 Sep 2008 12:48:25 GMT appended to Administrator. For example, Domain\UsernamePassword.”
If it installed by local account it will be “UsernamePassword” only.


Created by
Ahmed Abdel Moneim



Configuring WSS 2.0 SP 2.0 to work with BizTalk 2006


Issue #3


Problem: After installing the WSS 2.0, it gave the below error when trying to save the configuration in the SharePoint administration page:
“System Error 1057 while trying to query service "SPTimer"”


Reason: because the Identity of the SharePoint Application Pool configured as below


Resolution: set the identity with the format “Machine Name OR Domain Name\User Name”




Created by
Ahmed Abdel Moneim


Installing WSS 2.0 SP 2.0 to work with BizTalk 2006

Issue #2
Problem: When completing the Labs, I installed the WSS 2.0 with Service Pack 2.0 with default options, but when I read the installation guide I discovered that I should select “Farm” WSS 2.0 with Service Pack 2.0 with default options, but when I read the installation guide I discovered that I should select “Server Farm” under “Type of Installation”, I uninstalled it, then I try to installed it again, but the I didn’t see “Type of Installation” window again.


Reason: because when installing WSS 2.0 it creates MSDE instance and it create DB that stores all the options you select.

Resolution: Uninstall it from Add\Remove Programs “Microsoft SQL Server Database Engine (SharePoint).

Created by
Ahmed Abdel Moneim

Rule Engine Service Configuration Problem

Issue #1:

Problem: When Uninstalling BizTalk server 2006 and try to configure the rule engine, it gave the below error :

"Port 3132, which is required by the Rule Engine Update Service, is being used by another application, Restart this computer and rerun configuration."






Reason: after I install windows share point services 3.0, the “SharePoint Central Administration” site use it.



Resolution:Change the port in IIS manager.



Created byAhmed Abdel Moneim

Wednesday, April 11, 2007

ASP.Net Quick Tips - State Management

February 28

ASP.Net Quick Tips
- State Management





Sursa


The web is inheritently stateless, however, ASP.Net provides you with a very
comprehensive list of options to overcome this lack of statelessness. Using them
effectively is a critical of a successful ASP.Net application.


Tip: Do not use the Application statebag.


Cache does everything you can do with Application. Application was created to
smooth the transition of ASP.Old users to ASP.Net. There is no reason to use
Application and it should be avoided.


Tip: Use a safe pattern for accessing objects from a
statebag
.


All statebags take the form of a key/value dictionary. While they are very
easy to work with, if you are not careful you can introduce subtle issues and
potentially open yourself up to a hard to debug exceptions.


The ideal pattern takes the form of:

MyObject obj = StateBag["key"] as MyObject;
if(obj == null)
{
//Do Something here

}


Using this pattern helps to avoid multiple lookups, race conditions, and
invalid cast exceptions. The most common abuse of this rule looks like this:

MyObject obj = null;
if(StateBag["key"] != null)
{
obj = (MyObject)StateBag["key"];
}


In the bad example above, we look up the key twice, introduce a possible race
condition (what if in-between the key look up and request it is removed), and
have a possible invalid cast if the type of object stored by "key" is not of the
type "MyObject" (or a derivative/etc).


Tip: Understand the importance of HttpContext.Items.


The HttpContext provides a per request statebag you can use to store objects
that are only needed on the current request. As I have mentioned before it
is advisable to avoid Session when possible. However, there are likely objects
which are re-used through the course of a request and HttpContext.Items is an
idea place for them. The first time I ever heard of the HttpContext.Items was in
an article "A Matter of
Context
" by the great Susan Warren.


Tip: Do not overlook Cookies and Hidden fields.


As I have mentioned a couple times by now, I generally recommend avoiding
Session. But there are quite a few times when you need to store values between
requests and Cache/Database/etc just do not make sense. Cookies are an excellent
candidate to temporary information which needs to exist across multiple pages
and hidden fields can be used as a way of quickly tucking away values on a per
page basis.


Tip: Know what is in your cookies and ViewState.


Both cookies and viewstate provide excellent ways to store data, but you must
always keep in mind that this data will travel to and from the server on every
request. Keep it small and simple.


Tip: Do not store secure/secret data in Cookies, Hidden fields, or
ViewState.


If you do not want users reading data, tampering with data, etc then do not
push it down the client and store it on their machines. This is the equivalent
of a putting something shiny and red in front of a baby and then saying do not
touch.


Tip: Consider using a Ticket for more safely obscuring data in a
cookie on the client.


As the tip above states, you should not put secure data on the client.
However, there times you may want to store data on the client via a cookie and
do not want them to be able to tamper with it. ASP.Net ships with an API/object
called FormsAuthenticationTicket which is used to safely manage your Forms
authentication cookie. You can leverage this API and store your own information
in a cookie on the client.


To do so, simply create a new FormsAuthenticationTicket
, pass it a few settings, and your "secret data". From there you call
FormsAuthenticationTicket.Encrypt which returns a string you can store in a
cookie. Here is quick example:

string secretData = "secret";
DateTime dt = DateTime.Now;
FormsAuthenticationTicket newTicket =
new FormsAuthenticationTicket(1, "ticketName", dt,

dt.AddDays(7), true, secretData);

HttpCookie newUserCookie = new HttpCookie("theCookie");
newUserCookie.Value = FormsAuthentication.Encrypt(newTicket);
newUserCookie.Expires.AddDays(7);


Response.Cookies.Add(newUserCookie);


To re-use the data, simply fetch the cookie and call the
FormsAuthentication.Decrypt method:

HttpCookie userCookie = Request.Cookies["theCookie"];
string secretData = null;
if(userCookie != null)

{
FormsAuthenticationTicket ticket =
FormsAuthentication.Decrypt(userCookie.Value);
secretData = ticket.UserData;
}


Tip: For custom ASP.Net server controls, if you need to make sure a
value is persistent, use Control State and not ViewState.


As stated previously, I generally recommend disabling ViewState. As a control
developer, this can cause problems since there maybe times when using something
like ViewState is necessary for your control to function properly. Thankfully in
ASP.Net 2.0, as a developer, you now have a new option, Control
State.


Fritz Onion has a great detailed
explanation of Control State
:



Control state is essentially another state repository whose contents is
propagated much like view state, but the purpose of the control state
repository is to cache data necessary for a control to properly function. To
put it another way, behavioral state for a control should be kept in control
state, and UI state (its contents) should be kept in view state. Thus in the
new GridView class, you can completely disable view state, and the pagination
and editing events still fire as expected.


As always, I am eager to hear your feedback, additions, and suggestions. I am
working on a separate post with tips on the most important state management
option, caching, which is why I avoided the topic here.


FYI, this is part three of a continuing series of ASP.Net Tips. If you
found this post helpful, you may want to check out the other posts in the
series: General
ASP.Net Tips

ASP.Net Quick Tips Web.config

February 28

ASP.Net Quick Tips
- Web.config




Sursa




The first round of ASP.Net
Quick Tips
was very successful. I have about 30 or so tips jotted down, but
I am always looking for more. I am leaning towards doing them by theme/topic
with state management/cache, data access, web controls, accessibility/standards,
and tips from around the web are in the queue. But as the title suggests,
today is all about the web.config.


Tip: Set debug = "false" before you go to production.


This really is not a tip, it is a must. NEVER go to production with debug
purposely set to true.


<compilation defaultLanguage="c#" debug="false" />


As
ScottGu points out
(click through for a lot information on the topic)



  1. The compilation of ASP.NET pages takes longer
    (since some batch optimizations are disabled) 
  2. Code can execute slower (since some additional debug paths are
    enabled) 
  3. Much more memory is used within the application at runtime 
  4. Scripts and images downloaded from the WebResources.axd handler are not
    cached

Tip: If you do not control your production environment, set your
trust level to medium.


<trust level = "Medium" />


More and more ISP's and server administrators are setting the ASP.Net trust
level to medium. There are quite a few things you cannot do in ASP.Net while
using Medium Trust. In most cases, you can work around this, but it is
better to know while you are writing the code than when a customer sends you an
error message that simply states their was a security exception. (In addition,
the term security exception generally freaks them out).One of the hardest tasks we ever had to complete on Community Server was to get it to
function properly under Medium trust after we had written a substantial amount
of code. Our checked in web.config now has the trust level set to medium which
makes these issues very apparent as soon as they are created.


Note: By far, the most frequent case of medium trust issues is external
HttpRequests. Under medium trust it is not possible to make an
external HttpRequest without changes to your local policy or via a
proxy
. For Community Server, we recommend you use a proxy which is supported
out of the box. Because of these extra configurations steps, out of
the box, the Community Server web.config does not force medium trust.


Tip: Disable session state when not in use.


<sessionState mode="Off" />


I will not get into the virtues/issues with session, but needless to say,
most applications can be written to not use it (we make no use of session in Community Server). If you are not using
it, turn it off. The overhead is minor, but it is something that happens on
every request.


Tip: Disable ViewState


<pages enableViewState="false" />




Read more: http://meshaje.spaces.live.com/Blog/cns!439D09C4A8EA3868!118.entry

Thursday, April 5, 2007

Hello

I will strat my first blog in technical knowledge, here i will start a series of posts for articles that will help you in improve your .NET software development skills.
my dream is to make egypt enterprise software production country like fareast countries.
feel free to contact me on my email address
Ramado80@gmail.com in case you need any help regarding this subject.
i wish to you all a career full of success.
Salam