asp.net - Microsoft.SqlServer.Types with Service Fabric -
problem pretty simple. moved webapps project service fabric had microsoft.sqlserver.types nuget package installed. now, when trying access database i'm getting following error because i'm using spatial types.
"spatial types , functions not available provider because assembly 'microsoft.sqlserver.types' version 10 or higher not found. "
i've tried adding following line of code class fabricruntime creates instance of, of no use.
sqlservertypes.utilities.loadnativeassemblies(appdomain.currentdomain.basedirectory); your appreciated, please let me know if need more info me.
you need line of code, asp.net application should different: asp.net websites, default.aspx.cs:
public partial class _default : system.web.ui.page { static bool _issqltypesloaded = false; public _default() { if (!_issqltypesloaded) { sqlservertypes.utilities.loadnativeassemblies(server.mappath("~")); _issqltypesloaded = true; } } } for web applications, in global.asax.cs:
sqlservertypes.utilities.loadnativeassemblies(server.mappath("~/bin")); also need create following binding redirect in web.config:
<runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="microsoft.sqlserver.types" publickeytoken="89845dcd8080cc91" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-14.0.0.0" newversion="14.0.0.0" /> </dependentassembly> </assemblybinding> </runtime> here discussion on topic helped me.
update: here blog post provides described solution in 3 steps. although, third step didn't work me , had create binding described above.
Comments
Post a Comment