Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wtsyung opened this issue Sep 6, 2022 · 4 comments
Open

Comments

@wtsyung
Copy link

wtsyung commented Sep 6, 2022

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
Copy link
Author

wtsyung commented Sep 6, 2022

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.

@geral2
Copy link
Owner

geral2 commented Sep 9, 2022

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

@wtsyung
Copy link
Author

wtsyung commented Sep 9, 2022

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.

@geral2
Copy link
Owner

geral2 commented Sep 10, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants