COM+ Application Config. Issue

A

Abbas

Hello,

I have a COM+ application built using C# and the MSI for it runs just
dandy, its basically a COM proxy for .NET to ASP. However, when
running a test VBScript, I get the following message whenever I
attempt to execute one of the methods (object seems to get created
though)..

on this line: set objCreditAppEntity =
objComProxy.GetSavedApplication(1, "CITDE")

with this message: Error retrieving certificate with ID <> from
location LocalMachine
and this stack trace:
System.Configuration.ConfigurationException

Stack Trace:
at
CIT.EAI.Crypto.CertificateManager.RetrieveCertificateFromStore(X509CertificateStore
store, String keyIdentifier)
at CIT.EAI.Crypto.CertificateManager.GetDefaultCertificate()
at CIT.EAI.Web.Security.WseUtilities.GetClientToken()
at
CIT.EAI.Web.Security.WseUtilities.ConfigureProxy(WebServicesClientProtocol
protocol)
at CIT.EAI.EFCanada.ComProxy.RepositoryFactory.GetCreditAppWS()
at
CIT.EAI.EFCanada.ComProxy.EFCanadaComProxy.GetSavedApplication(Int32
creditAppId, String applicationCode)


Any ideas why? seems to be a WSE thing, but I'm lost as I'm still kind
of a newbie to COM, etc...This proxy talks to three web services by
the way.



VBScript test code given below
----------------------------------------------
Dim objComProxy
Dim arrContact
Dim errCode
Dim objCreditAppEntity
Dim objCreditAppEntityList
Dim objQuoteEntity
Dim objQuoteEntityList
dim xmlDoc, sPath, sFile, sInFileName


Set objComProxy =
CreateObject("CIT.EAI.EFCanada.ComProxy.EFCanadaComProxy")

'ERROR HERE
set objCreditAppEntity = objComProxy.GetSavedApplication(1, "CITDE")

WScript.Echo "Credit app ID: " & objCreditAppEntity.CreditAppId
WScript.Echo "Credit app status code: " &
objCreditAppEntity.CreditAppStatusCd
 
N

Nicholas Paldino [.NET/C# MVP]

Abbas,

Do you have a configuration file that WSE uses to set up the proxies
that you use to call the services? Have you deployed that with your COM+
application?
 
A

Abbas

Nicholas,

I am taking over this project from my team lead who left, and it has
been deployed once before to our development server (I am just making
updates) so I am sure there is a configuration file, would this file
happen to have a .config extension? (I'm not in the office and hence
can't browse myself). Also, how would I deploy the file, manually or
through the MSI?

Thanks
 
N

Nicholas Paldino [.NET/C# MVP]

Abbas,

Check out this blog article on setting up configuration files for COM+
applications when developed in .NET:

http://blog.devstone.com/aaron/archive/2004/10/18/310.aspx

It should help you find the configuration file for your COM+ app (which
I believe the original problem stems from) and then allow you to proceed
from there.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Abbas said:
Nicholas,

I am taking over this project from my team lead who left, and it has
been deployed once before to our development server (I am just making
updates) so I am sure there is a configuration file, would this file
happen to have a .config extension? (I'm not in the office and hence
can't browse myself). Also, how would I deploy the file, manually or
through the MSI?

Thanks
 
A

Abbas

I looked within the DLL directory and discovered that there is a
configuration file, which looks like:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="CIT.EAI.EFCanada.ComProxy.CreditAppWS.CreditApplication"
value="http://repositoryservice/CreditApplication.asmx" />
<add key="CIT.EAI.EFCanada.ComProxy.QuoteWS.Quote" value="http://
repositoryservice/Quote.asmx" />
<add key="CIT.EAI.EFCanada.ComProxy.CustomerSearchWS.SearchCustomer"
value="http://customersearchservice/SearchCustomer.asmx"/>
<add
key="CIT.EAI.EFCanada.ComProxy.FinancialCalculatorWS.FinancialCalculator"
value="http://159.3.133.80/CalculatorService/FinancialCalculator.asmx"/<add key="MessageQueueName"
value="FormatName:DIRECT=OS:stsbizdev01\CitDigitalEdgeEFCanSubmittal" /</appSettings>
</configuration>

I tried to rename this file from its original name given to
application.config and started getting this error instead:
Value cannot be null. Parameter name: Url

However, looking at the currently deployed COM, the config file is
still named CIT.EAI.EFCanada.ComProxy.config
 
A

Abbas

Located the code throwing the error:

Try

If store.OpenRead() Then

' Find the certificate based on the server's base64
key identifier
' This can be either a Windoes key indentifier or an
RFC3280 key identifier

Dim certs As X509CertificateCollection =
store.FindCertificateByKeyIdentifier(Convert.FromBase64String(keyIdentifier))


' Check to see if we found any certificates.

If certs.Count > 0 Then
' there should only be one cert since we used a
unique ID, so use the first in the array
cert = certs(0)
Else
' If we did not find any throw an exception

Throw New Exception("Key not found")
End If
End If
Catch ex As Exception
msg = String.Format("Error retrieving certificate with ID
<{0}> from location {1}", keyIdentifier, store.Location)
Throw New ConfigurationException(msg, ex)
 
A

Abbas

If anyone is interested to the solution...

1) make sure you have installed your certificate to be used by WSE
2) I needed an entry in my machine.config file which the WSE utility
reads to get key information for encryption

Cheers!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

COM+ Configuration Issue 1

Top