Error in deploying SQL CLR - c#

Error1:
The following error might appear if you deploy a SQL CLR project that was built for a version of the .NET Framework that is incompatible with the target instance of SQL Server: "Deploy error SQL01268: CREATE ASSEMBLY for assembly failed because assembly failed verification". To resolve this issue, open the properties for the project, and change the .NET Framework version.
Error2:
Deploy error SQL01268: .Net SqlClient Data Provider: Msg 6503, Level 16, State 12, Line 1 Assembly 'system.servicemodel, version=3.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' was not found in the SQL catalog.
An error occurred while the batch was being executed.

Have to install System.ServiceModel in Sql Server 2008 and it worked after that.
Happy Coding :)

Related

Call .NET Standard DLL in SQL Server

I have a requirement set upon me to run a .NET Standard project from T-SQL. I'm finding very little info about this. I've set the TRUSTWORTHY setting to ON.
Importing the test program dll I'm receiving the error below.
I try importing the netstandard.dll from the C:\Program Files\dotnet\sdk\2.2.103\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\ folder. This fails with the error below. But even after importing System.Data.Common from the same folder I keep receiving the error below.
When importing netstandard.dll from the C:\Program Files\dotnet\sdk\NuGetFallbackFolder\netstandard.library\2.0.3\build\netstandard2.0\ref folder I receive no errors. However when calling the function I receive the error below.
Msg 10313, Level 16, State 51, Line 17
An error occurred while using the .NET Framework during IL compilation. The server may be running out of resources. Try running the query again. If the problem persist, contact a support professional.
System.IO.FileLoadException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0x80131050) See Microsoft Knowledge Base article 949080 for more information.
System.IO.FileLoadException:
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
.NET Framework assemblies work without issue. Is running .NET Standard assemblies supported on SQL Server? If it's not supported what would be the workaround? Is there any solution more simple than calling a web service through .NET Framework and letting the web service call the .NET Standard code?
SQL Server supports .NET Framework 4 assemblies, using certain libraries listed at https://learn.microsoft.com/en-us/sql/relational-databases/clr-integration/database-objects/supported-net-framework-libraries?view=sql-server-2017.
The latest "what's new" page regarding CLR in SQL Server mentions only features added in SQL Server 2012: https://learn.microsoft.com/en-us/sql/relational-databases/clr-integration/clr-integration-what-s-new?view=sql-server-2017
.NET Core and .NET Standard are newer things (introduced in 2014 and 2016, respectively).

I reinstalled Entity Framework and now it's giving error

I initially got a problem in DB due to which I re-installed entity framework (earlier my version was 5.0 and now I installed 6.1.3), I am connected to SQL server but now I am getting an error which says:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: An error occurred creating the configuration section handler for entityFramework: Could not load file or assembly 'EntityFramework, Version=6.1.3, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Please tell me how to resolve it.
Thanks
Try to update your EntityFrame Work using this command from
update-Package EntityFramework
Also, make sure that the versions on packages.config and web.config match

Could not load file or assembly System, Version=2.0.5.0 in .NET 4 MVC 4 application

Been searching for ages, can't find anything helpful. Here is the exception I'm getting:
Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
Stack Trace:
[FileLoadException: Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)]
StructureMap.Graph.PluginGraph..ctor() in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\Graph\PluginGraph.cs:41
StructureMap.PluginGraphBuilder..ctor() in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\PluginGraphBuilder.cs:22
StructureMap.InitializationExpression..ctor() in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\InitializationExpression.cs:22
StructureMap.ObjectFactory.Initialize(Action`1 action) in c:\BuildAgent\work\996e173a8ceccdca\src\StructureMap\ObjectFactory.cs:47
...
This applications works fine on the test server but is throwing this exception on the production server. As you can see, the StructureMap code is what is causing the exception.
I had to convert this app to .NET 4 from 4.5 because 4.5 wasn't installed on the production server. After the conversion, the app still works fine on my local machine and the test server.
I have already set the Copy Local to True for the System assembly, but since the referenced version is 4.0.0.0 and not 2.0.5.0, I this made no difference.
Let me know if any more info is needed. Any help you may be able to provide is appreciated.
Make sure your .NET framework is patched. Microsoft released patches to .NET to allow Portable Class Libraries to properly find the appropriate runtime (KB2468871). If you are seeing the above exception (or something like it), it means you're missing the latest .NET framework patches.
Edit the web.config file to remove the reference, which is not required for normal operation:
1 - Open the web.config file in the root of your site
2 - Find the following line and comment it out():xxxxx-is your assembly name.
<add assembly="xxxxx", Version=2.0.5.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
3 - Save and close the web.config file and try again
I found that it was the "await" and "async" that where giving me trouble.
I had Windows XP SP3 with only .NET 4.0, but had to update it to .NET 4.0.3 using KB2600211 - this wasn't updated automatically through Windows Update when .NET 4.0.3 came out because the computer is off-grid.
This is the link to the update:
https://www.microsoft.com/en-us/download/details.aspx?id=29053
I just want to share another solution from here that solved the problem on my development machine: installing Silverlight 5 SDK (only 11.2MB at the time of writing this post) was enough to make everything working.
Install Microsoft® Silverlight® 5 SDK from the following link. It resolves and works fine for me.
SDK download
Starting from a machine configuration that only had VS2017 and Silverlight 5 SDK on it, I installed VS2015 on top of that. This is when I started getting the System.Core and System.Windows problems.
When I uninstalled VS2015 and re-installed Silverlight 5 SDK, these problems went away.

ASP.net Oracle DataReader in C#

I have an ASP.net appication in which it uses an ODP.net database connection. I have extracted the database handler into a dll file in order to extend its flexibility.
An error pops up occasionaly saying as follows:
Error 1 Assembly 'DatabaseConnection, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' uses 'Oracle.DataAccess, Version=4.112.2.0, Culture=neutral,
PublicKeyToken=89b483f429c47342' which has a higher version than referenced assembly
'Oracle.DataAccess, Version=2.112.2.0, Culture=neutral,
PublicKeyToken=89b483f429c47342' c:\Documents and Settings\Visual Studio
2010\Projects\DatabaseConnection\bin\Debug\DatabaseConnection.dll
Last time it happend, the error faded away automatically alone.
What is the reason for such error?
From the error look at the version number, your dll is expecting Oracle.DataAccess of Version=4.112.2.0 and i believe maybe in your GAC or bin you have a lower version 2.112.2.0.
Try to get the required version and this should be resolved.
Also - if you are using .Net 4.0 - you must use the 4.x assembly to be supported by Oracle.

i get System.MissingMethodException in winCE - C#

what this exception:
System.MissingMethodException was unhandled
Message: File or assembly name 'System.Windows.Forms, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC', or one of its dependencies, was not found.
how i can fix it ?
thank's in advance
This usually happens when you reference an assembly that has not been deployed to the device. Is the .Net compact framework version 3.5 installed on your device?

Categories

Resources