Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

Tuesday, November 11, 2014

Steps to configure - Custom Error Pages in IIS

IIS Version shown in the below post : 























Before setting up the custom error message in the IIS, the below message is shown.

















Follow the below steps to suppress error messages:
  • Goto Cordys Instance in the IIS.
  • Expand the Instance, there you will find the cordys folder inside.
  • Select the cordys folder & 
  • Double click the Configuration Editor (as shown in the picture below.)



Now, change the default selected mode to "Application Host as show in the below picture" and make sure Section selected is "System.webServer/httpErrors".
This helps us to change the properties shown below.

Now change the properties as shown in the below picture.
Follow the steps below :

Change the properties as suggested below

  • allowAbsolutePathWhenDelegated = True
  • errormode = Custom
  • Click Apply which will be on the right side of the configuration page under Actions



Now change the mode back to "CORDBOP4312/cordys web.config" and properties as shown in the below.
  • From  as CORDBOP4312/cordys web.config (CORDBOP4312 is the instance name here)
  • errormode as Custom
  • Click Apply


After setting all the properties, now set the path of the HTM Page in the error Pages as shown in the below picture:

  • Double click the Error Pages of the cordys folder
  • Double click 404 row item (Select any error status code which you want to configure, I have configured custom 404 page for my cordys site)
  • Unchcek the check box
  • Set the path of the HTM page
  • Click OK (Refer screenshot for above steps)

Restart the Cordys Site

Now Test the same throw browser and it shows like below



You can find the same explanation in a document which is shared here

--------------------------------------------
Credits : Kacham Naresh

Friday, August 1, 2014

Learnings from CORS : Call a webservice from other domains

Problem Statement :

We generally encounter a scenario where we have to access services which are not hosted locally (i.e., Other domain). This normally can't be achieved straight forwardly in html. We need to understand few points here which I will be explaining in this post.

References :

Explanation :

I would go with the assumption that one must know how to call a web service from html. If not the above reference would help in achieving this.

Note : A clear information that this is not possible in latest versions of chrome (I have tested only with browsers chrome and IE). This post is not meant for the applications which is using latest versions of chrome (http://bugs.jquery.com/ticket/4690 post would help you understand why).

Lets say you are using the same html file which is being explained in this post. Only difference being the gatewayURL which is the end point url being different.

How to solve it in IE :

Be it XMLHttpRequest or ajax request you can access services of cross domain using a browser property (this again depends on every client and also not secure). The property is as shown below in the image,



 After enabling this option one can access cross domain services in IE.

How to Enable in Chrome lower versions (I have chrome 16):

Although new versions of chrome doesn't support cross domain services at all but this can be achieved for lower versions of chrome using concept called "CORS". CORS stand for Cross Origin Resource Sharing. 

In Simple terms "Server has to authorize the client for cross domain accessing in case of chrome". This is not happening in IE as this is enabled at client side using settings of IE.

Problems/Resolution :

Possible errors from Chrome 16 are shown below :



Add below two properties to the website that you are using :

"Access-Control-Allow-Headers" with value "Content-Type"
"Access-Control-Allow-Origin" with value "*" (* generally represents allow any domain you have to google on how to give multiple domains, in general one domain is http://dhl-hyd1024)



Tuesday, March 11, 2014

My Gateway is unable to log in filesystem

Problem statement :

I have a custom gateway "sch.oauthint.OAuthHandler.wcp" and I can only debug via logging into filesystem (I know only this way of debugging :P unlike webservices which I can do it via eclipse). So I have encountered a strange problem as I saw there is an error in my application and I want to log. Whenever there is any error it logs in a file which starts lik "Gateway...." in my cordys logs folder but in this scenario I was not able to see the file at all. Hence a blocker for me to understand what is the issue. I have not observed this behavior when I do it in my local system. 

One Approach :

What our(me along with my colleague) understanding was that the user context with which it logs into file system was not having rights to write into file system and our understanding was right. Hence we need to give the rights to the folder "Logs" of the instance of cordys.

Below are the images which would help you in solving the problem :
First immediate task is to find out the user for your website. You can do it by going into IIS settings,


Default Web Site : Website where cordys is installed

You will be seeing "Authentication" as one of the artifact under IIS (highlighted)
Double click on that, You will be viewing a screen which is shown below








Now click on the Name which shows "Enabled" under status, in my case it was "Anonymous Authentication" now on the right side there are "Actions", click on the Edit to view the below screen.

 You will now be able to see what is the User with which it is trying to log.

"IUSR" in my case.Now the next immediate thing you have to do is to give the access permissions on folder "Logs" for this user. This step is shown below
Right click on the folder "Logs" under instance and click on sharing property. Give the access to the user you have found out above "IUSR" in my case.

You can view that in the following screen. 
When I have seen this option the access to the user "IUSR" was "Contribute"(I don't know what is the meaning of this option :P) but I have changed this setting to "Read/Write" which is when my problem got solved.


Note : However this was my approach of solving the problem. There might be different ways also to solve this problem (Windows user can be changed but I did not do that as this approach given me solution).  


Tuesday, February 11, 2014

How do I know which process is using which port

Recently I have encountered with a weird problem (Website is not being started) and there is an application error which is totally unclear to me. Just like any other person I have googled the error :P The interesting thing I have noticed is "Your website is not being started as there is some other application which is using port 80 (which is my website's port). ".

The explanation seems very clear but that won't solve my problem right :D
Now the task in my hand is " I have to find out the process which uses the port 80, which is very new to me." Finally I am able to achieve it and below was my approach.

Finding out which application is using port 80, One can find out using the command prompt what is the application's PID which is using port 80. A sample one is shown below





The results will show what is/are the application(s) which are using this port. In my example I searched the application which is using port "1521" and the screen shot shows the result. The command used to fetch the result is shown below

netstat -na|find "1521"

Give your port number instead of 1521. Now from the results you can figure out certain things, the third column will give the thing which you need. One of the result from the above is 

 TCP    192.168.10.127:1521    192.168.10.127:53710   ESTABLISHED

The highlighted column will convey everything, here in this case it is 192.168.10.127:53710

This 53710 is the PID of the process which is using this port.

From this I could able to find out the PID of the application which is using the port "80". Now I have to find out the process which is using this PID, this can be achieved by using task manager


From this I could understand that the application PID which I am searching is used by some other application which is "Skype", which is when I have realized that "Yes this problem occurred when I have installed skype". Normally I did not get any hint of how come skype will be the reason for this problem. What I did was just killed the skype application and then started the IIS. 

No wonder IT WORKED.










----------------------------------------------------------------------------------------------------
[Updated from here on 19th Nov 2014]
There is a software "ProcessExplorer" which is a freeware and which identifies the process with a specific PID. After you identifying the PID using the above process, run the procexp.exe and locate the process bearing this PID which you have recorded.



Now my next task is to try and identify what is the process which is bearing the PID : 4340 and from the above image I could see that it is a java.exe and I know that each cordys soap container will create a new java.exe and so I try to debug by looking into CMC (Cordys Management Console) which is an application which shows the container status and information about each container. Now try and locate the container which has the same PID as the one which you wanted (4340).

  
Its found out to be as LDAP. By this one could understand that LDAP is the java.exe which is running on a port which you are checking.

----------------------------------------------------------------------------------------------------------
Dated : 08-07-2015

You can find the PID directly from a port using below command,

netstat -ano|find "1521"

I wanted to kill this process and I could not find it in task manager. I killed it from command prompt using below command, 

taskkill/f /PID /7076

---------------------------------------------------------------------------------------------------------

Thursday, December 19, 2013

Java : Unable to generate SAMLArt for HTTPS from Java

Unable to Create SAMLArt for https from Java:

The error was 

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetcom.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)
com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
java.io.BufferedOutputStream.flushBuffer(Unknown Source)

java.io.BufferedOutputStream.flush(Unknown Source)

Explanation about the issue :
  • The issue is because of certificate unavailability in keystore of the server. 
  • one can view the keystore contents from the command prompt. This command has to be executed from "%JAVA_HOME%/jre/bin path

    keytool -list -keystore "%JAVA_HOME%/jre/lib/security/cacerts"
  • The certificate must be available in the list provided from the above, to confirm there will be an entry with Fingerprint (MD5) value which should be identical of Fingerprint (MD5) value of the certificate.
  • Properties of the certificate can be visible from webserver.
  • If the certificate is not visible then one has to manually import the certificate using keytool commands.

    keytool -import -noprompt -trustcacerts -alias <AliasName> -file <certificate> -keystore <KeystoreFile> -storepass <Password>
  • One can list the keystore contents using the command mentioned in the above points, now the certificate has to be available.
  • Once this is done then World Wide Web has to be restarted to effect the change.
Entire details on how to set up https successfully will be found the document below