简体   繁体   中英

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

I have been looking for a while, still get the same error in this part of code:

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);
    }

I am attaching the web config code:

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

and app.config code:

<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" />

Please tell me what I'm doing wrong?

Seems like one of your connection strings is wrong.

One of the safest methods to get a valid connection string is to connect to your database in VisualStudio, then right click on the working connection, select "Properties", and copy the Connection String value shown into the config file which your repository is set to use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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