0

I've started using dapper to connect to SQL database. My application works fine when I run from within my c# application. Application simply runs a select statement on a local sqlexpress 2012 database. It returns the required data. When I place my dapper code into a service and host the service on IIS7 I get an error: Could not load file or assembly 'myapplication version = 1.0.0.0, Culture=neutral, PublicKey Token=null' or one of its dependencies. The system cannot find the file specified.

Previously I used Linq to SQL for the same database query and it works fine when hosted on IIS7. I expected dapper to work as I simply changed the code in the WCFservice.cs file and built the application. IIS7 Application Pool is ASP.Net v4.0

Any help appreciated.

  • From the error message it looks like the dapper dll is not deployed where it should be. I don't know much about deployment to IIS7, but once you get the dll to where it should be the code will probably start working again. – Sergey Kalinichenko Aug 12 '17 at 11:34
  • If the error says it's having trouble loading "myapplication", what makes you think it's something to do with Dapper? – DavidG Aug 12 '17 at 11:34
  • I Don't think this is dapper error but still can you confirm that bin pointed by IIS 7 application has Dapper related dll in there. – Ravi A. Aug 12 '17 at 11:50
  • @RaviA dapper.dll is in the iis folder. – OpenSerial Aug 12 '17 at 14:38
  • @DavidG when I change from linq to dapper the error appears. – OpenSerial Aug 12 '17 at 14:39
  • @OpenSerial - So when you change back to sql-linq and redeploy the application everything works fine ? In that case you can use Fusion log viewer for your failing scenario and see which dependent assembly load is failing. See https://stackoverflow.com/questions/4679279/debug-net-assembly-binding-aka-find-what-dll-is-used-and-why – Ravi A. Aug 15 '17 at 03:38

0 Answers0