I have used this method in the past and it worked fine, I do not have any idea what could have been changed down the line to cause this error to start appearing. Here is my current code:
var label = DYMO.Label.Framework.Label.Open("OrderLabel.label");
label.SetObjectText("lblcompany", company);
label.SetObjectText("lblcustomer", customer);
label.SetObjectText("lblorder", order);
label.SaveToFile(Server.MapPath("~/Labels/order.label"));
Response.ContentType = "label";
Response.AppendHeader("Content-Disposition", "attachment; filename = order.label");
Response.TransmitFile(Server.MapPath("~/Labels/order.label"));
Response.End();
The error seems to relate to the first line DYMO.Label.Framework.Label.Open("OrderLabel.label");
The documentation on DYMO label printing via asp.net is very scarce and I've searched and searched and only found a couple of references to this specific error. None of which have helped, obviously.
The solution to this problem was to uninstall the DYMO.Label.Framework that I had installed via NuGet Package Manager and download and install the SDK software provided by DYMO from this link: https://www.dymo.com/en-US/online-support-sdk
This download will add DYMO.Label.Framework.dll which you can then Add a Reference to via Visual Studio. Apparently there is some difference in the version provided via NuGet Package Manager and the one provided in the download from DYMO.