How to connect my webrole app (vb.net) to my sql azure database? - vb.net

I am creating a new application (webrole) in webforms called SGS. This application is being build using vb.net.
I am developing the app in windows 7 and have already deployed it to Windows azure.
Every time I need to change something in the application, I change it locally and then publish it again to my production enviroment (i know about staging enviroment in azure, but I prefered the production).
The app is in the start point, now I need to connect it to my database that is in SQL Azure.
I built a new database named SGS that is on SQL Azure and I want to connect my application to it.
I would like that even when I am in the local environment, my application only connects to my sql zure database. This way I don't need any database on my local Pc.
I don't know how to accomplish this.....
The connection string (ado.net) that is on the azure is :
Server=tcp:mwjw08qhju.database.windows.net,1433;Database=SGS;User ID=pr#mwjw08qhju;Password=myPassword;Trusted_Connection=False;Encrypt=True;
My webconfig file as this information:
<xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<connectionStrings>
Server=tcp:mwjw08qhju.database.windows.net,1433;Database=SGS;User ID=pr#mwjw08qhju;Password=myPassword;Trusted_Connection=False;Encrypt=True;
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<!-- <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial
Catalog=aspnet_1db0ca8ec36d4ba1852e5e4ec9947660;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />-->
<add name="DefaultConnection" connectionString=" <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet_1db0ca8ec36d4ba1852e5e4ec9947660;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
<add name="aspnet_1db0ca8ec36d4ba1852e5e4ec9947660Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=.\SQLEXPRESS;initial catalog=aspnet_1db0ca8ec36d4ba1852e5e4ec9947660;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false" defaultProvider="DefaultRoleProvider">
<providers>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</roleManager>
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</sessionState>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
What do I need to change to accomplish this?
Thank you very much.

This set up should do exactly what you want. It's only slightly more complex if you wanted to connect to SQL Server when running locally BUT SQL Azure when deployed.
To connect to SQL Azure from your local machine though, you'll need to have a firewall rule that allows traffic to reach SQL Azure. Ironically, the post right below yours in Stack Overflow has a response that should help you do this (if you haven't already).
If you set up the firewall rule and are still having issues, post back with more specifics about what's not working, error messages, etc.

Change the Service and Default connection strings to the connection string you received from the Azure SQL portal.
So you will get this:
<add name="ApplicationServices" connectionString="mwjw08qhju.database.windows.net,1433;Database=SGS;User ID=pr#mwjw08qhju;Password=myPassword;Trusted_Connection=False;Encrypt=True;" providerName="System.Data.SqlClient" />
Hope that helps

Related

Integrate open source mvc forum 1.5 with asp.net identity table?

Mvc forum 1.5 use membership table but my application create mvc 5+Entity framework 6 + asp.net identity table.how to integrated mvc forum with my application.
Hi Mahaveer,
You will have to do following changes in connection string and system.web:
The UserManagement_Connection is basically a connection string
<add name="UserManagement_Connection" connectionString="Data Source=.\SQLExpress;Initial Catalog=ASPNETDB;Integrated Security=false;User Id=userId;Password=pwd" providerName="System.Data.SqlClient" />
<system.web>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="UserManagement_Connection" applicationName="myapplication" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="RoleProvider">
<providers>
<add connectionStringName="UserManagement_Connection" applicationName="myapplication" name="RoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
Then directly you can use the Membership functions in your application
Let me know if you face any issue.
:)

Could not load type 'PayPal.Manager.SDKConfigHandler' from assembly 'PayPal_Merchant_SDK'

I am trying to integrate paypal mobile checkout into a mobile web app, developed using mvc4, for some reason, when I try to use the function SetMobileExpressCheckout(xxx), I am getting the above error.
I have added the web.config entry across from the sdk example, and have added the reference to the 2 dlls that come with the SDK, but it still crashes, the full error message is below :
{"An error occurred creating the configuration section handler for paypal: Could not load type 'PayPal.Manager.SDKConfigHandler' from assembly 'PayPal_Merchant_SDK'. (C:\Projects\Mobile Development\Print Management\Print Management\web.config line 8)"}
so looking at this, it is pointing to the entry in the web config file, which is added below, I have also created a new project with an empty site, added a page, and all the web.config entries etc, and it works fine.
Could it be something to do with mvc4 ??
I know the web.config entry is large, but I thought I would put it all in there incase it is something else in there causing the problem.
any help would be much appreciated, as I am very close to having this finished, but I just cant seem to find what the issue is here
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPal_Merchant_SDK"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-Print Management-20130104084836;Integrated Security=SSPI"/>
</connectionStrings>
<paypal>
<settings>
<!-- The URL that the user must be redirected to in order to login and approve some payment actions-->
<add name="paypalUrl" value="https://www.sandbox.paypal.com/webscr"/>
<!-- The API endpoint -->
<add name="endpoint" value="https://api-3t.sandbox.paypal.com/2.0"/>
<!-- Connection timeout in milliseconds -->
<add name="connectionTimeout" value="360000"/>
<!-- The number of times a request must be retried if the API endpoint is unresponsive -->
<add name="requestRetries" value="3"/>
<add name="binding" value="SOAP"/>
<add name="IPAddress" value="127.0.0.1"/>
<!--
API version number. You will not normally have to change this unless you
have a specific need to work with an older version of the API
-->
<add name="APIVersion" value="96.0"/>
</settings>
<accounts>
<!--
Add API credentials - 3 token or client certificate.
You can add multiple account credentials here. The SDK will pick the first account
unless you specifically request an account in the service wrapper mehod.
-->
<account apiUsername="emailaddress" apiPassword="validpassword" apiSignature="signature" applicationId="APP-80W284485P519543T" certificateSubject="" signatureSubject=""/>
<!--
<account apiUsername="enduser_biz_api1.gmail.com" apiPassword="SACH3VA3C29DXGUG"
apiCertificate="<Absolute path to paypal_cert.p12>"
privateKeyPassword="password" applicationId="APP-80W284485P519543T"/>
-->
</accounts>
</paypal>
<!-- Configure logging using the log4net library -->
<log4net>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="MerchantLog.log"/>
<appendToFile value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] %message%newline"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="FileAppender"/>
</root>
</log4net>
<appSettings>
<add key="webpages:Version" value="2.0.0.0"/>
<add key="webpages:Enabled" value="false"/>
<add key="PreserveLoginUrl" value="true"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880"/>
</authentication>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<add namespace="System.Web.Helpers"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/>
</providers>
</sessionState>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"/>
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
</entityFramework>
</configuration>
Had the same issue, and could resolve it by exchanging
PayPal_Merchant_SDK
to
PayPal_Core_SDK
in the configSections part.
The assembly name is wrong in the paypal doc and samples. The config section should reference the assembly name. So "PayPal_Core_SDK" should really be "PayPalCoreSDK"
well, after trying to get it working late into the evening yesterday, I decided to create a new mvc4 mobile web app, and only put in the paypal references etc, and low and behold, it worked, now I am not sure what is wrong with the other app, but I think it will probably be quicker to just transfer my code a cross section by section.
I just thought I would let people know, and if I get chance, I will look at the code again, as I don't like been beat :-)

Cannot add authentication on app with connection string error

I am trying to add authentication to my application using the built in provider however I am getting an error doing so. My web.config file is as follows (with the db etc taken out of connection string but does all work):
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<connectionStrings>
<add name="LaundryDBContext"
connectionString=".amazonaws.com,1433;
Initial Catalog=Main;
Persist Security Info=True;
User ID=****;
Password=****;
MultipleActiveResultSets=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="1.0.0.0"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
When trying to add authentication I am getting the following error:
The connection name 'ApplicationServices' was not found in the applications configuration or the connection string is empty.
I would love the authentication and application settings to be stored in the existing DB. how do I fix this?
The connectionStringName property of the provider entries are set to "ApplicationServices" which is not a named connection string in your web.config. Your connection string is named "LaundryDBContext".
Change the connnectionStringName property to "LaundryDBContext" and the provider will use that connection string to talk to your database.
You should read one of the many walkthroughs on configuring membership to understand how that works in more detail.
In brief...
open the visual studio command prompt and type aspnet_regsql
Follow the wizard in the dialog that opens to add the aspnet membership schema to your database.

Problem Deploying new application

Im new to this, so please forgive me. What im doing is deploying my application onto the server, it works fine on my local machine but im getting errors when I try to hit the server. Here is the error below and my web.config file. I dont know what im doing wrong.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Source Error:
Line 18: <add assembly="System.Design, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=B03F5F7F11D50A3A"/>
Line 19: <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
Line 20: <authentication mode="Forms">
Line 21: <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
Line 22: </authentication>
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data
source=.\SQLEXPRESS;Integrated
Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User
Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<customErrors mode="Off"></customErrors>
<compilation debug="true" strict="false" explicit="true"
targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Extensions.Design,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="ApplicationServices"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
I seem to recall this happening when you have deployed your application into a sub-folder of an existing site, and it it's web.config includes a setting that either applies to the entire site/application, and can't be modified on a per-folder basis
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level
I'd play with your
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
setting. Try moving it to the site's root web.config and see where that gets you, or remove it entirely.
Also, see (just from a quick Google)
Error: allowDefinition='MachineToApplication' beyond application level
http://geekswithblogs.net/ranganh/archive/2005/04/25/37609.aspx
ASP.NET IIS Web.config [Internal Server Error]
http://forums.asp.net/t/1031775.aspx/1

People Picker. I cannot receive FBA users in Admin Center Site

My database membership3 at .\sharepoint has many membership users.
There is web.config file for my Admin Center Site
<configuration>
<connectionStrings>
<add connectionString="Server=.\sharepoint;Database=membership3;Integrated Security=true" name="SQLAuthConnectionString" />
</connectionStrings>
<SharePoint>
<PeoplePickerWildcards>
<clear />
<add key="SQLAuthConnectionString" value="%" />
<add key="SQLMembershipProvider" value="%" />
<add key="SQLRoleManager" value="%" />
</PeoplePickerWildcards>
</SharePoint>
<system.web>
<roleManager defaultProvider="AspNetWindowsTokenRoleProvider" enabled="true" cacheRolesInCookie="false">
<providers>
<add name="SQLRoleManager" connectionStringName="SQLAuthConnectionString" applicationName="/" description="My Role Provider"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
<membership defaultProvider="SQLMembershipProvider">
<providers>
<add name="SQLMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SQLAuthConnectionString" passwordAttemptWindow="5" applicationName="/" enablePasswordReset="true"
enablePasswordRetrieval="false" passwordFormat="Clear" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" />
</providers>
</membership>
</system.web>
</configuration>
There is web.config file for my new claims-based site:
<configuration>
<SharePoint>
<PeoplePickerWildcards>
<clear />
<add key="SQLAuthConnectionString" value="%" />
<add key="SQLMembershipProvider" value="%" />
<add key="SQLRoleManager" value="%" />
</PeoplePickerWildcards>
</SharePoint>
<system.web>
<membership defaultProvider="i">
<providers>
<add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SQLMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SQLAuthConnectionString" passwordAttemptWindow="5" applicationName="/" enablePasswordReset="true"
enablePasswordRetrieval="false" passwordFormat="Clear" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" />
</providers>
</membership>
<roleManager defaultProvider="c" enabled="true" cacheRolesInCookie="false">
<providers>
<add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SQLRoleManager"
connectionStringName="SQLAuthConnectionString" applicationName="/" description="My Role Provider"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
</system.web>
</configuration>
File C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\Root\web.config :
<configuration>
<system.web>
<membership defaultProvider="i">
<providers>
<clear />
<add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SQLMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SQLAuthConnectionString" passwordAttemptWindow="5" enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="true" passwordFormat="Clear" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="c">
<providers>
<clear />
<add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="SQLRoleManager" connectionStringName="SQLAuthConnectionString" applicationName="/" description="My Role Provider"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
</system.web>
<connectionStrings>
<add connectionString="Server=.\sharepoint;Database=membership3;Integrated Security=true" name="SQLAuthConnectionString" />
</connectionStrings>
</configuration>
I want setting up User Policy in Admin Center Site and FBA users are not coming in People Picker. But my claims-based authentication site login aesy with any FBA user. What is wrong in Admin Center Site settings?
Add
<add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
in Mermbership
and
<add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
in Role manager at Central Admin web config file
Have you tried writing the exact name of the user in the CA people picker?