SQL-APIConsumer icon indicating copy to clipboard operation
SQL-APIConsumer copied to clipboard

Could not find Type 'StoredProcedures' in assembly 'APIConsumer'.

Open wtsyung opened this issue 3 years ago • 4 comments

I have followed the steps and create all assemblies. As soon as I get to the point on creating the first sp "API.Caller_WebMethod" I hit this error "Could not find Type 'StoredProcedures' in assembly 'APIConsumer'."

There's one difference I made on creating System.Net.Http assembly is that I cannot use the one given from the your project due to some versioning issue? I ended up created it using the one provided from GAC_MSIL. The version of System.Net.Http from GAC_MSIL is 4.8.3761.0 where the one from the file is 4.6.23409

If this is the cause, would there any way I can fix it? (I am using SQLServer 2017)

CREATE ASSEMBLY [System.Net.Http] AUTHORIZATION dbo FROM 'C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Net.Http\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Net.Http.dll' WITH PERMISSION_SET = UNSAFE; GO

wtsyung avatar Sep 06 '22 06:09 wtsyung

Sorry I've reading deeply on Step 5 from other threads. It was saying to rebuild the DLL? May I get to know what's the meaning to it? I get the sense I have to use the dll given from the project, but I am lack of skills on creating an assembly using an older version of dll instead from GAC_MSIL.

Any help will be appreciated, thanks.

wtsyung avatar Sep 06 '22 09:09 wtsyung

Hi @wtsyung, sorry for late response. Could you please paste the exact error message you're getting?

geral2 avatar Sep 09 '22 01:09 geral2

Thanks for reading up, @geral2 First, if I tried create the assembly with the System.Net.Http.dll you provided, This will be the error I am getting:

Warning: The Microsoft .NET Framework assembly 'system.net.http, version=4.0.1.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.' you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details. Msg 6586, Level 16, State 1, Line 12 Assembly 'System.Net.Http' could not be installed because existing policy would keep it from being used.

I then tried create the assembly using another one C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Net.Http.dll. It successfully created the assembly. Unfortunately it prompted me error when creating stored proc CREATE PROCEDURE [dbo].[APICaller_WebMethod] @httpMethod NVARCHAR (MAX) NULL, @URL NVARCHAR (MAX) NULL, @JsonBody NVARCHAR (MAX) NULL AS EXTERNAL NAME [API_Consumer].[SQLAPI_Consumer.StoredProcedures].[APICaller_WebMethod]

it returns me with: Msg 6505, Level 16, State 2, Procedure APICaller_WebMethod, Line 1 [Batch Start Line 4] Could not find Type 'SQLAPI_Consumer.StoredProcedures' in assembly 'APIConsumer'.

I have read some related issue threads (#10 & #25). It seems to be some versioning issue of the system.net.http.dll between yours (4.0.1.0) and the SQL server (4.0.0.0). They all seems fixed their own issue but I don't exactly know how they did it. Greatly appreciated for any advice to it, thanks.

wtsyung avatar Sep 09 '22 02:09 wtsyung

Could you please try deploying from this release 2.3.5 sql script; Especifically script 0 and 1.

https://github.com/geral2/SQL-APIConsumer/releases/download/v2.3.5/1.API_Consumer.v2.3.5.sql

Please let me know if any other issue.

geral2 avatar Sep 10 '22 23:09 geral2