There was a strange problem these two days.
When using. Net to call the booksopen method of Excel, an error occurs:
Method not found: excel. workbook excel. workbooks. open (system. string, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object ).
Note:An error occurred while executing the current Web request. Check the stack trace information for details about the error and the source of the error in the code.
Exception details:System. missingmethodexception: method not found: excel. workbook excel. workbooks. open (system. string, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object, system. object ).
I searched the internet and found this error, mostly because the exce referenced during compilation is different from the Excel version in the running environment.
However, if I compile locally and run locally, this problem should not occur.
My web program references an internal library, the internal library references Excel, and calls the books open method of Excel.
Structure:
I tested on three machines. On the two machines, I reported that the open method could not be found, and one was normal.
Later, I found a solution: Reference Excel com again in the Web application project, and the test will be normal.
However, I still don't know the exact cause of this situation.