Hi,
I'm trying to pass a dynamic connection string but I'm getting an error. Below are the codes:
Connection String:
Factory:
var repo = new DefaultUserAccountRepository(CreateMembershipRebootConnectionString());
public static string CreateMembershipRebootConnectionString()
{
var connString = ConfigurationManager.ConnectionStrings["MembershipReboot"].ToString();
if (HttpContext.Current.Request.UrlReferrer != null)
{
Uri url = HttpContext.Current.Request.UrlReferrer;
if (url.HostNameType == UriHostNameType.Dns)
{
string host = url.Host;
String[] subDomains = host.Split('.');
return String.Format(connString, subDomains[0] + "MembershipReboot");
}
}
return String.Format(connString, "MembershipReboot");
}
The above codes work with Thinktecture.IdentityServer.Core.EntityFramework and BrockAllen.MembershipReboot
Below are the error message and stack trace:
Message: "An error has occurred.",
ExceptionMessage: "An error occurred when trying to create a controller of type 'AuthorizeEndpointController'. Make sure that the controller has a parameterless public constructor.",
ExceptionType: "System.InvalidOperationException",
StackTrace: " at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 0 at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 0 at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext() in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Extensions\ScopeExtensions.cs:line 0",
InnerException: {
Message: "An error has occurred.",
ExceptionMessage: "An exception was thrown while executing a resolve operation. See the InnerException for details. ---> A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist. ) (See inner exception for details.)",
ExceptionType: "Autofac.Core.DependencyResolutionException",
StackTrace: " at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 0 at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable
1 parameters) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 0 at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 0 at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable
1 parameters) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 0 at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType, IEnumerable1 parameters) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 0 at Autofac.ResolutionExtensions.ResolveOptional(IComponentContext context, Type serviceType) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 0 at Thinktecture.IdentityServer.Core.Hosting.AutofacScope.GetService(Type serviceType) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 25 at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage request, Type controllerType, Func
1& activator) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 0 at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType) in c:\etc\Dropbox\source\Thinktecture\Thinktecture.IdentityServer.v3\Core\source\Core\Hosting\AutofacScope.cs:line 0",
InnerException: {
Message: "An error has occurred.",
ExceptionMessage: "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. The specified LocalDB instance does not exist. )",
Thank you,