Complilation error when trying to customize the start kit template

Discussion in 'ASP.NET / ASP.NET Core' started by faye190, Apr 14, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I downloaded the template for Small business web site. I followed the steps on this web site for changing the source of database from XML file to a sql server 2000. However, when I trythe "View in Browser", I get the message below:


    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS1502: The best overloaded method match for 'System.Configuration.ProviderSettingsCollection.this[string]' has some invalid arguments

    Source Error:








    Code:
    Line 39:         }
    Line 40: 
    Line 41:         _provider = ProvidersHelper.InstantiateProvider(_providersSection.PeopleProviders[_providersSection.PeopleProviders], 
    Line 42:             typeof(PeopleProvider)) as PeopleProvider; 
    Line 43: 
    Source File: d:\Small_Business_Starter_kit\App_Code\People\People.cs Line: 41


    Any idea how I can fix it?

    Thanks

    Faye
     
  2. That Starter Kit is generally easy to setup, you can even remove most of those providers in it if you don't need them.
    Unless I'm mistaken the error you're getting locally is from the settings in the web.config
    There is a forum section for this starter kit in the http://asp.net forums if you need specific help with it.
    Salute,
    Mark
     
  3. Can you please explain to me what I need to do in order to use sql server 2000 database as opposed to xml files?





    thanks


    Faye
     
  4. Sure...Give me about an hour to download it and take a look. (It's been a few months since I looked at that one.)
    Salute,
    Mark
     
  5. Mark,
    Thanks for your help. In the webconfig file I named my connection string:


    PeopleProvider
    When I try the "View in browser, I get this error message with respect to SqlPeopleProvider.cs
    Compiler Error Message: CS0117: 'SmallBusinessDataProvidersSection' does not contain a definition for 'PeopleProvider'

    refers to this line for SqlPeopleProvider.cs

    string connectionStringName = sec.PeopleProvider[sec.PeopleProviderName].parameters["peopleprovider"];





    Thanks





    Faye
     
  6. Belowis aweb.config I just created for using that Starter Kit with SQL Server.
    Just replace the connection string "YOU" sections with your accounts SQL conn.
    If you need anymore help let me know.

     
  7. Thank you so much


    I test it tomorrow and let you know.





    Faye
     
  8. Mark,
    My database is on my local machine for now because I have not published my web site yet. therefore, I changed the connection string in the webconfig file you created to:



    <connectionStrings>


    <clear />


    <remove name="SQLConnectionString"/>


    <add name="SQLConnectionString" connectionString="Data Source=Faye;ntegrated Security=SSPI; Database=smallBusiness;>"


    providerName="System.Data.SqlClient" />


    </connectionStrings>





    And then there is the smallbusiness Data Providers


    <SmallBusinessDataProviders


    peopleProviderName="SqlPeopleProvider"


    testimonialsProviderName="SqlTestimonialProvider"


    catalogProviderName="SqlCatalogProvider"


    newsProviderName="SqlNewsProvider"





    Then I was led to change the code in:


    Private Static void Initialize()


    where the line says: typeof(peopleprovider) as PeopleProviders to:


    typeof(peopleprovider) as PeopleProvider





    Here is the compliation error I get:



    Compilation Error


    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0117: 'SmallBusinessDataProvidersSection' does not contain a definition for 'PeopleProvider'

    Source Error:







    Code:
    Line 19:     {
    Line 20:         SmallBusinessDataProvidersSection sec = (ConfigurationManager.GetSection("SmallBusinessDataProviders")) as SmallBusinessDataProvidersSection;
    Line 21:         string connectionStringName = sec.PeopleProvider[sec.PeopleProviderName].parameters["peopleprovider"];
    Line 22:         return WebConfigurationManager.ConnectionStrings["PeopleProvider"].ConnectionString;
    Line 23:     }
    Source File: d:\Small_Business_Starter_kit\App_Code\People\SqlPeopleProvider.cs Line: 21



    what do I need to change?


    :
     
  9. Are you using XP or Vista?
    I'll post the steps you need to enable connections on your local machine.
     
  10. XP.


    Faye
     
  11. Here goes...

    When SQL Server, Express or full versions, is installed it will by default create security measures for SAC.
    (Surface Area Configuration.)

    When you are installing you can tell it to allow these connections.

    If you didn't it's going to do you a favor and not allow them. [​IMG]

    To enable these SAC settings after SQL Server is installed:
    1. Start menu Program group for SQL Server
    2. Configuration Tools sub menu.
    3. SQL Server Surface Area Configuration tool.
    4. In the bottom, Surface Area Configuration for Services and Connections.
    5. Now you'll be able to see the Instance name and you can change the SAC settings. (Remote Connections)
    Your local server instance is what you want to use in your conn string.
    Shown below is the SQL Server conn string for my local testing.

    <connectionStrings>
    <clear />
    <add name="ConnectionString1" connectionString="Data Source=SPEEDY\WISEMX;Initial Catalog=DASPtemp;Integrated Security=True"
    providerName="System.Data.SqlClient" />
    </connectionStrings>


    Note: I also add the local account user, WISEMX, to SQL Server so I have permissions while testing locally.
    Even though WISEMX is an administrator on the Windows system SQL Server will need that user added.
    </CODE>


    Post Edited (wisemx) : 4/15/2008 8:38:09 PM GMT
     
  12. I am working with SQL server 2000 not 2005, I was not able to find Surface area configuration option for it.

    Faye
     
  13. Actually I never had to do that with SQL Server 2000.
    Unless I'm mistaken it was a new security feature years after 2000 was released.

    Looks like I also got this thread a bit mixed up. [​IMG]

    Did you create SQL Server objects that don't exist on both local and remote SQL Servers?
    Or are you actually not able to connect locally and the objects do exist locally?
    Salute,
    Mark
     
  14. I only created one database called small business locally. I did not create any more database specific for Peopleprovider or Catalog, etc. My local connection seems to be ok.
     
  15. You'll probably do better to strip those functions out of that kit.
    I did for one of the accounts here because they just needed the basics in it.
    Salute,
    Mark
     
  16. I will try that today.

    Faye
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page