tags:

views:

124

answers:

2

I'm getting this error while trying to run my login page. Here's my stack trace:

[ArgumentException: No provider is defined with the name evanmoor_sales Parameter name: providerName] SubSonic.DataService.GetInstance(String providerName) in C:\svn\subsonicproject\trunk\SubSonic\DataProviders\DataService.cs:163 Emcom.Sales.SalesUser.GetTableSchema() in C:\work\2007.evan-moor.com\Sales.DataAccess.Generated\Generated\SalesUser.cs:123 Emcom.Sales.SalesUser.SetSQLProps() in C:\work\2007.evan-moor.com\Sales.DataAccess.Generated\Generated\SalesUser.cs:102 Emcom.Sales.SalesUser..ctor() in C:\work\2007.evan-moor.com\Sales.DataAccess.Generated\Generated\SalesUser.cs:73 salesreps_Login.SalesRepLogin(Object sender, EventArgs e) in c:\web\sites\dev.evan-moor.com\salesreps\salesreplogin.aspx.cs:25 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

And here's the provider section of my web.config file:

<SubSonicService defaultProvider="evanmoor_web">
 <providers>
  <clear/>
  <add name="evanmoor_web" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="evanmoor_web" generatedNamespace="Emcom"/>
  <add name="evanmoor_standards" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="evanmoor_standards" generatedNamespace="Ts"/>
  <add name="evanmoor_sales" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="evanmoor_sales" generatedNamespace="Emcom.Sales"/>
 </providers>
</SubSonicService>

Any suggestions? I'm using SubSonic 2.1.0, so it should be the latest version.

A: 

Never mind, I had a space in the App.config of my DataAccess class on accident.

A: 

I ran into this too, for a different reason, and it took some searching to root out the problem so I thought I'd share my solution.

I had set up my web.config with defaultprovider=provider1, then needed to change it to provider2. I replaced all instances of provider1 in all my files and ran the app, but hit this error, and sure enough in the details of the error message namespace1 showed up, so obviously find & replace within Visual Studio was not enough.

In the end, I had to delete the myClass.xml files that Studio had generated in \bin and \obj\debug files. Those were not getting rebuilt despite cleaning and rebuilding the solution, and they still held references to the old setup.

Meg