English 中文(简体)
NET 4. 8 Azure 函数 : 无法装入类型
原标题:.NET 4.8 Azure Function : could not load type
I m making an Http triggered Azure Function v4 in .NET 4.8 with Microsoft.NET.Sdk.Functions 1.0.24 and my test endpoints that do not reference any other assemblies work correctly. However, when I try to use a method in a referenced assembly, I get the following error: Could not load type System.Data.SqlClient.SqlParameter from assembly System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 . at Example.Data.PeopleBiz.GetPersonByUserName(String username) at Example.OperationFunc.DoItFunction.DoItEndpoint(HttpRequestMessage req, TraceWriter log) I m sorry I cannot post code due to confidentiality and the scale of the solution. I realize this probably restricts the assistance to people who have overcome this specific issue. Has anyone gotten a large .NET 4.8 Azure Function to work? Running locally in VS2022, this function works flawlessly. Here are some relevant environment vars: { "name": "FUNCTIONS_EXTENSION_VERSION", "value": "~4", "slotSetting": false }, { "name": "FUNCTIONS_WORKER_RUNTIME", "value": "dotnet-isolated", "slotSetting": false }
问题回答
You probably need to explicitly add a reference to the correct version of System.Data.SqlClient, which is the package that holds SqlParameter. The version referenced in your error message (4.0.0.0) is not a version that is available on NuGet for System.Data.SqlClient. I think the fact this runs fine locally is probably because you have SQL or SQL Types installed locally.




相关问题
Windows Azure WorkerRole response

I am working on an Azure demo to run Powershell in a worker role. In my web role I add the name of the Powershell script which is to be run to a CloudQueue object. I can print the script output to ...

Windows Azure WebRole stuck in a deployment loop

I ve been struggling with this one for a couple of days now. My current Windows Azure WebRole is stuck in a loop where the status keeps changing between Initializing, Busy, Stopping and Stopped. It ...

Getting a token for Windows Azure

We are looking at Windows Azure, but getting a token appears to be hard now, at least that s what I m seeing in web searches. Anyone tried it or know how to accelerate that process? Any idea how long ...

Developing Azure .Net 4.0 Applications

Presently .Net 4.0 is not supported on Azure. This thread indicates that you will not be able to use .Net 4.0 with VS 2010 until it is supported in the cloud. http://social.msdn.microsoft.com I d ...

.NET 4.0 on Windows Azure?

My google-fu is failing me on this one. As a possible solution to Unit Testing .NET 3.5 projects using MStest in VS2010 (but I ve put this in a seperate question because it s kind of unrelated): Is ...

热门标签