1

looking for assistance as to how to consume a WCF service library from an HTA file.

Basic summary - there are a whole suite of process enhancement tools that integrate with a booking system in the form of HTA files.

We needed to have the system communicate with a web service using X509 certificates as the security signature.

Therefore we have built a WCF class library that uses a service reference to the web services. After some tweaking and fine tuning of the app.config - we have got this communicating with the web service perfectly (using a windows form test app)

So to enable communications through to the HTA files we've written a COM wrapper, that exposes the WCF library functions.

So far so good - however when we try and run the HTA we get the infamous

'Could not find endpoint element with name ........'

I have tried all sorts of things to try and resolve this: Making sure all dll files and hta files are in the same directory. I have copied the app.config from the WCF dll and added it's contents to an app.config file on COM wrapper. I've even tried adding an config file to the MSHTA.exe file in the System32 directory!!

So far nothing has helped and allowed the HTA file to get the WCF service call to work.

Any advice much appreciated. Cheers Darren

DarrenNavitas
  • 239
  • 3
  • 11

2 Answers2

1

First, try compiling all of your client-side .NET projects with x86 explicitly set as the target (including the WCF class library and the COM wrapper).

Then use the x86 RegAsm.exe to register your COM wrapper (which is C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe, as opposed to the x64 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe).

Finally, use the x86 mshta.exe (which is C:\Windows\SysWOW64\mshta.exe, as opposed to the x64 C:\Windows\System32\mshta.exe) to test it.

noseratio
  • 59,932
  • 34
  • 208
  • 486
  • Thanks for your help - but still no luck! Everything had already been built as x86 - as we have to remain compatible with some archaic API's that are 32bit!! Tried forcing use of the SysWOW64 version of mshta - but still no luck :-( – DarrenNavitas Jun 17 '14 at 14:41
  • @DarrenNavitas, hard to guess what else might be wrong. You may want to try making your COM wrapper a managed out-of-proc server, rather than in-proc: http://stackoverflow.com/a/22674920/1768303 – noseratio Jun 17 '14 at 19:46
0

Finally I have got it working!

Thanks to @Noseratio who's suggestions forced me to go over everything again!

It was the mshta.exe file that needed it's own app.config file. I had already tried copying the app.config file from the WCF DLL, but made a schoolboy error when naming it as mshta.config rather than mshta.exe.config.

Once named correctly the HTA file was able to communicated with the web service through the com wrapper and WCF DLL.

Cheers Darren

DarrenNavitas
  • 239
  • 3
  • 11