我有个问题.我无法将迁移添加到我的ASP.NET WebAPI 2项目中.我收到错误:
"此提供程序无法使用空间类型和函数,因为无法找到程序集"Microsoft.SqlServer.Types"版本10或更高版本."
我知道有几个问题和答案,如:
但!问题是...
当我尝试运行Add-Migration v002时,这是完整的错误:
System.InvalidOperationException:此提供程序无法使用空间类型和函数,因为无法找到程序集"Microsoft.SqlServer.Types"版本10或更高版本.
zh_cn System.Data.Entity.SqlServer.SqlTypesAssemblyLoader.GetSqlTypesAssembly()zh_cn System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(String wellKnownText)zh_cn System.Data.Entity.Spatial.DbGeography.FromText(String wellKnownText)zh_cn System.Data .Entity.Migrations.Model.ColumnModel.CreateDefaultValue()
zh_cn System.Data.Entity.Migrations.Model.ColumnModel..ctor(PrimitiveTypeKind type,TypeUsage typeUsage)zh_cn System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty) property,TypeUsage conceptualTypeUsage,TypeUsage defaultStoreTypeUsage,IDictionary2 annotations) en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty property, ModelMetadata modelMetadata, IDictionary2 annotations)
en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.<> c__DisplayClass2e3.b__2df(EdmProperty p)en System.Data.Entity.Utilities.IEnumerableExtensions.Each [T]( IEnumerable1 ts, Action1 action)en System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildCreateTableOperation(EntitySet entitySet,ModelMetadata modelMetadata)zh_cn System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.b__194(EntitySet es)en System.Linq.Enumerable.WhereSelectEnumerableIterator 1..ctor(IEnumerable 1 source)zh_cn System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(ModelMetadata source,ModelMetadata target,Lazy 1 modificationCommandTreeGenerator,MigrationSqlGenerator migrationSqlGenerator, String sourceModelVersion,String targetModelVersion)zh_cn System.Data.Entity.Migrations.DbMigrator.Scaffold(String migrationName,String …
我们的一个类库使用Microsoft空间类型,如DbGeography.在没有旧版本的SQL Server和Visual Studio的干净机器上运行我们的应用程序时,我们得到以下异常:
空间类型和函数不适用于此提供程序,因为无法找到程序集"Microsoft.SqlServer.Types"版本10或更高版本.
解决方案显然是安装这个nuget包:
Install-Package Microsoft.SqlServer.Types
Run Code Online (Sandbox Code Playgroud)
安装后,nuget包提供了有关如何从每个项目类型引用DLL的说明:
若要将使用空间数据类型的应用程序部署到未安装"SQL Server的CLR类型"的计算机,还需要部署本机程序集SqlServerSpatial110.dll.
此程序集的x86(32位)和x64(64位)版本已添加到SqlServerTypes\x86和SqlServerTypes\x64子目录下的项目中.如果未安装C++运行时,还包括本机程序集msvcr100.dll.
您需要添加代码以在运行时加载这些程序集中正确的一个(取决于当前的体系结构).
ASP.NET应用程序对于ASP.NET应用程序,将以下代码行添加到Global.asax.cs中的Application_Start方法:SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("〜/ bin"));
桌面应用程序对于桌面应用程序,在执行任何空间操作之前添加以下代码行:SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
nuget包项目网站没有响应,所以我不确定这是2016年最好的方法.
我的问题是,我无法弄清楚如何从ASP.NET Core 1.0应用程序调用LoadNativeAssemblies.我们使用的是完整框架(net461),而不是核心框架.
public class Startup
{
public Startup(IHostingEnvironment env)
{
...
SqlServerTypes.Utilities.LoadNativeAssemblies(env.WebRootPath);
...
}
}
Run Code Online (Sandbox Code Playgroud)
在ASP.NET 1.0应用程序中包含SqlServer.Types dll文件的最佳方法是什么?
非常感谢.
我有一个使用 SQL 服务器空间数据类型的 .net4.5 Web 应用程序项目。
在开发机器上完美地在本地工作,但是当部署到应用程序服务器时,当我尝试在具有空间数据的表上运行查询时出现以下错误:
System.InvalidOperationException: DataReader.GetFieldType(5) returned null.
Run Code Online (Sandbox Code Playgroud)
我发现如果服务器上未安装 SQLServer,则不支持空间数据类型。
因此,我将 nuget 包安装到我的项目中:
Install-Package Microsoft.SqlServer.Types
Run Code Online (Sandbox Code Playgroud)
这添加了对 Microsoft.SqlServer.Types 的引用并创建了一个包含一些 dll 的 SqlServerTypes 文件夹。
将项目重新部署到服务器后,还是不行(同样的错误)。
nuget 包中的说明说我必须将以下行添加到 applciaion_start 事件中:
SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
Run Code Online (Sandbox Code Playgroud)
我试过这样做,但我在 SqlServerTypes 下看到一条蓝色波浪线,并在 Visual Studio 中显示错误“SqlServerTypes 未声明”。
我试过添加
Imports Microsoft.SqlServer.Types
Run Code Online (Sandbox Code Playgroud)
但没有 SqlServerTypes 命名空间或类。
我被告知要使用Microsoft.SqlServer.Types的DbGeography一个作业项目,我有。作业项目是使用 ASP.NET,并尝试使用数据库来搜索数据库中的内容。(数据库应该来自一个.bak文件,但我不得不将一个.bacpac文件上传到 azure 然后连接回它,因为该.bak文件一直说它已损坏)。
这是我被告知要放入Global.asax.cs文件的代码块:
protected void Application_Start()
{
// For Spatial types, i.e. DbGeography
SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
// This next line is a fix that came from: /sf/ask/922193821/#40166192
SqlProviderServices.SqlServerTypesAssemblyName = typeof (SqlGeography).Assembly.FullName;
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
Run Code Online (Sandbox Code Playgroud)
我看过文档,该死的东西只是说:
Microsoft.SqlServer.Types
允许您在未安装 SQL Server 的计算机上使用 SQL Server 空间类型。启用要使用的实体框架空间类型(DbGeography 和 DbGeometry)。
其中我认为只是意味着这个包使我们能够使用C表达式SQL,但我想一个更好的解释。我不知道做什么DbGeography和DbGeometry做什么。
此外,我想知道这是否适用于基于 azure 的数据库,而不仅仅是由 .bak 文件制作的本地数据库。
sql-server asp.net asp.net-mvc entity-framework nuget-package
错误:
本地报告处理期间发生错误。
报告“Include\Impresiones\Rport.rdlc”的定义无效。
此报表的定义无效或不受此版本的 Reporting Services 支持。
报表定义可能是使用较新版本的 Reporting Services 创建的,或者包含基于 Reporting Services 架构格式不正确或无效的内容。详细信息:报告定义具有无效的目标命名空间“http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition”,无法升级。
当我有 VS2012 时,我可以毫无问题地编辑它,但现在我更新到 VS2019,当我编辑报告并想在报告查看器中显示它时,我收到该错误,如何解决?
在我的web.config我有:
<system.web>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*"
type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false"/>
</httpHandlers>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<!--<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>-->
<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
<buildProviders>
<!--<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>-->
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, …Run Code Online (Sandbox Code Playgroud) asp.net ×4
sql-server ×3
asp.net-core ×1
asp.net-mvc ×1
azure ×1
c# ×1
geospatial ×1
rdlc ×1
reportviewer ×1
vb.net ×1