My registration tool has a feature which allows candidates to load their personal information (like name, address, ..) from an ID.
When I compile the application with the build-in webserver in VS2010, and press the button to load ID information into textboxes, there is no problem. When I publish it on the localhost (with IIS), it crashes when I press the button.
This is what I received in my event viewer:
0
APPCRASH
Not available
0
w3wp.exe
7.5.7601.17514
4ce7a5f8
KERNELBASE.dll
6.1.7601.17651
4e211319
e0434352
0000b9bc
0
7e796e20-f3e1-11e0-8ea3-60eb69b01829
0
I'm working on a 64-bit laptop, use the Belgium Identity Card SDK.
Here you can find my code for the button;
protected void Button1_Click(object sender, EventArgs e)
{
//READ eID
ClearTextBoxes();
try
{
BEID_ReaderSet ReaderSet;
ReaderSet = BEID_ReaderSet.instance();
BEID_ReaderContext Reader;
Reader = ReaderSet.getReader();
bool bCardPresent = Reader.isCardPresent();
if (Reader.isCardPresent())
{
if (Reader.getCardType() == BEID_CardType.BEID_CARDTYPE_EID
|| Reader.getCardType() == BEID_CardType.BEID_CARDTYPE_FOREIGNER
|| Reader.getCardType() == BEID_CardType.BEID_CARDTYPE_KIDS)
{
try
{
Load_eid(Reader);
}
catch (Exception ex)
{
labelEx.Text = ex.Message;
}
}
else
{
labelEx.Text = "No valid card, please insert a valid IDcard";
}
}
else
{
labelEx.Text = "No IDcard found, please insert your card";
}
BEID_ReaderSet.releaseSDK();
}
catch (BEID_Exception ex)
{
BEID_ReaderSet.releaseSDK();
labelEx.Text = "No valid cardreader found, please connect a valid reader";
}
catch (StackOverflowException ex)
{
BEID_ReaderSet.releaseSDK();
labelEx.Text = "Error: " + ex;
}
catch (OutOfMemoryException ex)
{
BEID_ReaderSet.releaseSDK();
labelEx.Text = "Error: " + ex;
}
}
private void Load_eid(BEID_ReaderContext Reader)
{
try {
BEID_EIDCard card;
card = Reader.getEIDCard();
if (card.isTestCard())
{
card.setAllowTestCard(true);
}
BEID_EId doc;
doc = card.getID();
txtFirstN.Text = doc.getFirstName();
txtLastN.Text = doc.getSurname();
txtDOB.Text = doc.getDateOfBirth();
//CUT GETSTREET IN STREET AND HOUSENO
string street= doc.getStreet();
string[] words = street.Split(' ');
txtStreet.Text = words[0];
txtHouseNo.Text = words[1];
txtPostalCode.Text = doc.getZipCode();
txtCity.Text = doc.getMunicipality();
//sText += "Country = " + doc.getCountry() + "\r\n";
}
catch (Exception ex)
{
BEID_ReaderSet.releaseSDK();
labelEx.Text = "Error: " + ex;
}
}
How can I solve this problem?
Most likely your Application Pool is running under a user which does not have a privilege to access the card reader. This would cause a driver fault which can crash the w3wp.exe process.
Change it to a dedicated user and assign appropriate privileges for this user, or for testing purposes, set it to run under localsys.