My WebJob is missing dependency - c#

I've created a webjob with a simple C# Console application. I make use of the Azure blobs and a database connection - locally everything works like a charm.
In Azure portal I've made a simple app where I added my exe and force it to run. From the logs i get:
[10/09/2016 20:38:52 > ed5cb9: ERR ] Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Don't mind the 6.0.0.0 version, I've tried 7.0.0.0 and the latest 7.2.1, the result does not differ.

Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
According to the error you provided, I recommend that you could try to make sure the specific assembly is deployed to Azure. You could use Kudu Console (Can be accessed from Azure : App Service > Web App> Development Tools > Advanced Tools)
and check your assembly in the following path:
d:\home\site\wwwroot\app_data\jobs\[triggered|continuous]\{job name}
Additionally, if you deploy your WebJob via the Azure Portal, you could directly upload a zip file that contains the WebJob's files. For more details about Web Jobs, you could follow this tutorial.

Related

FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer, Version=5.0.0.0 on IIS

I'm working on a microservices project based on .net 5 and recently add API versioning to the gateway endpoint (using Microsoft.AspNetCore.Mvc.Versioning and Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer).
API Versioning is working on my local machine but after deploying my project on IIS, I ran into the following error:
FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
Let me know if you have the solution
You should add Microsoft.AspNetCore.Mvc.Versioning and Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer on Web.Medario.HttpAggregator.deps.json file existing in publish output files.

IBM.Data.DB2 FileNotFound Loading Microsoft.ReportingServices.Interfaces

I have a ASP.Net application which references an assembly with some re-usable code (common utils, data access, etc.). The assembly references IBM.Data.DB2.dll. However, I am not using DB2 in my application, the IBM.Data.DB2.dll is simply a dependency (in case an app needs to connect to DB2). Recently, i've run into the following error:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ReportingServices.Interfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.ReportingServices.Interfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at Unity.AutoRegistration.AutoRegistration.<ApplyAutoRegistration>b__5(Assembly a)
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Unity.AutoRegistration.AutoRegistration.ApplyAutoRegistration()
The only file in the entire application that contains Microsoft.ReportingServices.Interfaces is the IBM.Data.DB2.dll file. I do not have any need of SQL Server or the overhead of a SQL Server installation locally much less on the server when the app is deployed. Bear in mind I am required to use the assembly which has the dependency on IBM.Data.DB2.dll and this error has not happened in the past, it seems to be recent.
I have tried binding redirects, installed Microsoft.ReportingServices.Interfaces via Nuget all to no avail.
Would anyone know why this error is occurring and more importantly....how to resolve it?
If IBM.Data.DB2.dll references Microsoft.ReportingServices.Interfaces, you will probably have to manually copy Microsoft.ReportingServices.Interfaces.dll into your bin folder. Here is a post that can help you with that:
Microsoft.ReportingServices.Interfaces.dll missing for SSRS 2005

Windows service cannot find reference to sshNet

I am trying to write a windows service(My first windows service) that uploads a file to sftp using SshNet. When i install and debug the service i get the error:
Could not load file or assembly 'Renci.SshNet, Version=2013.4.7.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.
I think when i build the application the reference is not being copied to the exe file. Not sure though. Any help would be great. Also I added the reference with nuget if that helps.

Unable to run Websphere MQ application once deployed

Good day. I have developed an application which works successfully on my local machine but I have run into a problem when moving out to production.
The error is as follows:
System.IO.FileNotFoundException: Could not load file or assembly 'IBM.XMS.Admin, Version=2.5.0.0, Culture=neutral, PublicKeyToken=d2666ab12fca862b' or one of its dependencies. The system cannot find the file specified.
File name: 'IBM.XMS.Admin, Version=2.5.0.0, Culture=neutral, PublicKeyToken=d2666ab12fca862b'
I understand where this file is - C:\Prog... - and my .Net application is simply referencing IBM.XMS.dll which works. It's when I deploy and run I get the error above.
I used the following installation instructions and restarted the system too:
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzav.doc/un10290_.htm
Your application is built with XMS v2.5. Do you have XMS v2.5 (shipped with MQ v7.5 client) installed on the other machine?
check out Microsoft's fusion log viewer and see how you get on.
In my experience when I see this message the keywords are or one of its dependencies. The fusion log may help you find out which one.

FileNotFoundException in Portable Class Library?

I have 3 assemblies, a WP7 app (targeting 7.0), a Web Services project (running 4.0), and a Portable Class Library (built from the template & targeting WP7, SL4 & .NET 4.0) which contains a common type used between the first two.
When run locally (in IIS Express) things work just fine, however when run against a deployed instance of the Web Services assembly (on a remote IIS server I have little control of) fails with the following exception:
System.IO.FileNotFoundException: Could not load file or assembly
'System.Xml.Serialization, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' or one of its dependencies. The
system cannot find the file specified. File name:
'System.Xml.Serialization, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' ---> System.IO.FileNotFoundException:
Could not load file or assembly 'System.Xml.Serialization,
Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
Retargetable=Yes' or one of its dependencies. The system cannot find
the file specified. File name: 'System.Xml.Serialization,
Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
Retargetable=Yes'
The stacktrace indicates that it is on the first call into the PCL, which would make sense if it's a type load failure like above.
If I remove the reference to the PCL assembly and then add the key class file to both assemblies, things work fine, however I want to avoid this kind of code duplication... so the question is: Why is this happening? How can I configure the PCL to function as written?
EDIT: A little more information... my PCL uses XmlSerializer, something that lives in System.Xml.dll on the desktop, and in System.Xml.Serialization.xml in Silverlight... an assembly that doesn't exist under the full desktop framework... so this failure makes some sense, only in the PCL world, some of these assemblies/classes are broken out on their own
In this case, XmlSerializer actually lives in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile2\System.Xml.Serialization.dll (which is referenced by the PCL)... as a test I added the same reference to the Web Project... however at runtime of the web project, it fails with yellow screen of death stating that:
Could not load file or assembly 'System.Xml.Serialization' or one of
its dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
You will need to install KB2468871 on the remote server. It's a GDR that has been pushed to most client machines - however, servers will need to opt into it (they typically don't automatically install updates).

Categories