繁体   English   中英

“ /”应用程序中的服务器错误。 提供程序未返回ProviderManifestToken字符串。

[英]Server Error in '/' Application. The provider did not return a ProviderManifestToken string.

我已经寻找了一段时间,在这部分代码中仍然遇到相同的错误:

public ViewResult List(string category, int page = 1)
    {

        ProductsListViewModel viewModel = new ProductsListViewModel
        {
            Products = repository.Products
                .Where(p => category == null ? true : p.Category == category)
                .OrderBy(p => p.ProductID)
                .Skip((page - 1) * PageSize)
                .Take(PageSize),
            PagingInfo = new PagingInfo
            {
                CurrentPage = page,
                ItemsPerPage = PageSize,
                TotalItems = category == null ?
                    repository.Products.Count() :
                    repository.Products.Where(e => e.Category == category).Count()
            },
            CurrentCategory = category
        };
        return View(viewModel);
    }

我附上了网络配置代码:

<configuration>
<connectionStrings>
<add name="SportsStore" connectionString="Data Source=ASUS-ПК;Initial Catalog=SportsStore;Integrated Security=True;Pooling=False" providerName="System.Data.SqlClient"/>

和app.config代码:

<connectionStrings>
<add name="SportsStoreEntities" connectionString="metadata=res://*/Concrete.ORM.SportsStore.csdl|res://*/Concrete.ORM.SportsStore.ssdl|res://*/Concrete.ORM.SportsStore.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ASUS-ПК;Initial Catalog=SportsStore;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

请告诉我我做错了什么?

似乎您的连接字符串之一是错误的。

获取有效连接字符串的最安全方法之一是在Visual Studio中连接到数据库,然后右键单击工作连接,选择“属性”,然后将显示的“连接字符串”值复制到存储库设置为的配置文件中采用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM