Hello Coders :),

           feel good when error comes..but when it take lots of time and make me fail to solve,getting eritate mind... SO finaly comming to you guys with one hope that you all will help me to solve this....

           I am working on asp(Classic) application ..to converting old classic funtionality into new aspx pages...Now i am at one point that have to must run some code via asp.net application..but getting error in my below code...

  MSScriptControl.ScriptControl sc = new MSScriptControl.ScriptControl();
  sc.Language = "VBScript";
  string expression = "1 + 2 * 7"; //it will having any vb script....
  object result = sc.Eval(expression);
  Response.Write(result.ToString());

Now what is the error : it as below:
Retrieving the COM class factory for component with CLSID {0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

For you Note: what i have done:!!
I have add refernce dll: msscript.ocx

let me know !! if you can help me for this simple error for you. :)

Regards,
Dhimmar13.

~~~ life is not about problem you have,but how nicely you solved it...:)

Dani AI

Generated

As @LastMitch hinted, 0x80040154 (REGDB_E_CLASSNOTREG) usually means the COM object cannot be created because it is either not registered for the process bitness or the host process and the ActiveX/COM component have mismatched architectures. On 64‑bit Windows a 64‑bit w3wp.exe cannot load a 32‑bit in‑proc COM server (msscript.ocx), so you see that HRESULT when the control is missing or registered only for the 32‑bit view. (stackoverflow.com)

Quick, practical steps to resolve this for an IIS-hosted site:

  • If the server is 64‑bit, run the app pool in 32‑bit mode: IIS Manager → Application Pools → select pool → Advanced Settings → Enable 32‑Bit Applications = True. (learn.microsoft.com)
  • Register the 32‑bit Script Control with the 32‑bit regsvr32 (run cmd.exe as Administrator):
%windir%\SysWOW64\regsvr32 "%windir%\SysWOW64\msscript.ocx"

Use the SysWOW64 regsvr32 when registering 32‑bit OCXs on 64‑bit Windows. After registration, recycle the app pool. (support.microsoft.com)

A caution: the Microsoft Script Control is old and apartment‑threaded; it was not designed for high‑concurrency server hosting and can cause serialization/blocking and security risks if you evaluate script from untrusted input. Prefer modern, safer approaches for server‑side scripting (for example the Roslyn scripting APIs or isolated/out‑of‑process sandboxes) if you need runtime expression evaluation. (pauliom.com)

This expands on @LastMitch’s platform tip and applies specifically to ’s scenario: enable 32‑bit app pool or run your worker process as x86 (compile/publish as x86), register the OCX with the 32‑bit regsvr32, and then retest.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.