我在 Framework 4.7.2 中有我的主要项目,这个项目引用了一个 netStandard Library 项目,它是一个 netstandard 2.0。
我需要 .Net Standard 项目中的“DbProviderFactories”。
喜欢:
System.Data.Common.DbProviderFactory fact = System.Data.Common.DbProviderFactories.GetFactory(providername);
Run Code Online (Sandbox Code Playgroud)
我可以将 netStandard Project 版本更改为 2.1,其中包含 DbProviderFactories,但 netstandard 2.1 不使用框架 4.7.2
有没有其他方法可以做到这一点。
我这里有 2 个应用程序。一个是 Xamarin 应用程序,另一个是 Asp.Net MVC 应用程序,它具有连接到 SqlServer 数据库的 WebApi,“其中数据库位于某个 IP 地址 xxx.xxx.xxx.xxx 之类的托管网站上”。
我在 IIS 本地运行 MVC 应用程序,然后在 IIS 中启动网站后,我从 Visual Studio 的第二个实例运行 Xamarin 应用程序。
首先,我认为 MVC WebApi 不会被调用,因为我尝试将断点放在那里,但它没有出现在那里。我不知道为什么。因为我对 Winforms 和 MVC 应用程序 (WebApi) 做了同样的事情,所以至少 WebApi 被调用了,我在 MVC 应用程序中看到了断点。
现在在 Xamarin 中,我收到此错误
System.Net.Http.HttpRequestException: 'Network subsystem is down'
Run Code Online (Sandbox Code Playgroud)
在行中
var responseTask = await client.GetAsync("ConnectToAscDatabase");
Run Code Online (Sandbox Code Playgroud)
我在 Xamarin 应用程序的 MainPage.cs 中有此代码
private async void Button_OnClicked(object sender, EventArgs e)
{
HttpClientHandler handler = new HttpClientHandler();
handler.UseDefaultCredentials = true;
using (var client = …Run Code Online (Sandbox Code Playgroud)