I have a MVC app that is loading a external DLL and when in production I get no error at all. Firefox just says the connection was reset. So I put some try/catch in the code but they still do not work, I still get the connection reset message.
I know the error is a BadImageFormatException but why don't I see anything in the browser?
 public class HomeController : Controller
    {
        [DllImport("CDCrypt.dll")]
        [return: MarshalAs(UnmanagedType.LPStr)]
        public static extern String Encrypt([MarshalAs(UnmanagedType.LPStr)] String aName);
        [DllImport("CDCrypt.dll")]
        [return: MarshalAs(UnmanagedType.LPStr)]
        public static extern String Decrypt([MarshalAs(UnmanagedType.LPStr)] String aName);
        //
        // GET: /Home/
        public ActionResult Index()
        {
            try
            {
                ViewBag.EncryptString = Encrypt("test");
            }
            catch (Exception e)
            {
                ViewBag.EncryptString = "Stack Trace\r\n:" + "\r\nException: " + e.Message;
                return new HttpStatusCodeResult(500);
            }
            return View();
        }
        public ActionResult Up()
        {
            ViewBag.Up = "You can see me";
            return View();
        }
    }
 
     
     
    