i have developed the client program which is using webmethod’s smtp service.
The cilent program works as below. step1. The client program query data and save a excel file. step2. The client program call the webmethod’s smtp service to send the excel file. step3. after invoking the service ,if the result is success, move file to success folder. if the result is fail, move file to fail folder.
but error occured at step3 as below statment.
"The program cannot access the file because it is being used by another process" So I have checked all Step andI have found that step 2 has problem which is about connecting smtp server.
Sometimes smtp service can’t connect smtp server,
after invoking, it is processing file still.
From the error message “The program cannot access the file because it is being used by another process” it looks like before the service which is trying to create the file and save is completed , the other service is trying to connect to access the file to send it to the SMTP Server
Check the following
Make sure you close the file stream before you invoke the next service
Wrtie a test service which calls the webMethods SMTP service and sends a mail ( you can use this service to test if there is any problem with the SMTP server ,in this way you can isolate if the problem is with SMTP or with the file creation service )