I am very new to Azure and WebServices so please bear with me here. Basically, I have a WebService that references 3 different dlls SOCreate.dll, EOTCBase.dll, EOTC_InBuffer.dll, not standard .NET dlls but rather dlls from other projects I have. After I published a WebService on Azure successfully, I am calling my WebService which calls a method in EOTCBase.dll. The method in EOTCBase.dll tries to load an EOTC_InBuffer.dll assembly like so:
Assembly dbAssembly = Assembly.LoadFile(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\EOTC_InBuffer.dll");
but that call fails with an error The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
When I check what files I have on Azure I can see my WebService and a bin folder:
then I go inside the bin folder and can see all 3 dlls in there:
I guess that means that all 3 dlls are published on Azure and are available in bin folder. I tried to google for something similar but wasn't able to find a similar scenario. Could somebody please maybe point what's wrong here or maybe reference a link to some reading materials? Thank you.
P.S. It almost looks like that all those 3 dlls in the same bin folder based on Azure Console output but in fact some of them not in there actually.
UPDATE
I mean open kudu
on the portal, and manually add the mydll
folder as in my screenshot. The specific path of the .dll file is D:\home\site\wwwroot\mydll\a.dll
. In this way, if the operation is successful, you don't need to worry about the temporary folder. Copy all the .dll files that will be used to the mydll
folder.
PRIVIOUS
You can use dynamic load function to use your .dll file. If this is successful locally, and unsuccessful after deployment, then the problem should be the Azure cloud environment.
#region Dynamically load .dll
object obj=null;
byte[] filesByte;
Assembly assembly;
Type type;
MethodInfo timerInitial;
MethodInfo timerDispose;
#endregion
private void LoadDll()
{
try
{
filesByte = File.ReadAllBytes(Path.GetDirectoryName(Application.ExecutablePath) + "//EOTC_InBuffer.dll");
assembly = Assembly.Load(filesByte);
type = assembly.GetType("EOTC_InBuffer.dll");
obj = System.Activator.CreateInstance(type);
timerStart = tp.GetMethod("TimerStart");
timerStop = tp.GetMethod("TimerStop");
if (timerStart != null)
{
timerStart.Invoke(obj, null);
}
}
catch(Exception)
{
}
}
You are successful in running locally, but deploying to Azure will fail. This problem cannot be dealt with, because we cannot register the .dll in the Azure environment, nor can we read and load these .dll files in the bin folder through code.
I have replied to this question in another post before, and also tried to use the code to deal with this problem but all failed, I hope it will help you.
User contributions licensed under CC BY-SA 3.0