Creative Tailor Made - Bespoke - Custom Software Solutions

Error: 50 ā€“ Local Database Runtime error occurred

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. Cannot create an automatic instance. See the Windows Application event log for error details.)

If you google the error you will find many articles claiming solution. One of them is the following which is closest to final resolution of this problem.
Windows 7 SP1 causes IntelliTrace Collection to fail on IIS

The only thing that you should change is the IdentityType.
Meaning they suggest that you edit applicationHost.config file found in %windir%\system32\inetsrv\config\ specifically the ApplicationPools section.

It may work for someone but it didnā€™t for me. Then i had to play around with these settings. Finally when i changed the IdentityType to NetworkService i was able to use My newly created database (SQL Server 2012 express ā€“ localDB)

<add name="ASP.NET v4.0" managedRuntimeVersion="v4.0">
    <processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />

<add name="ASP.NET v4.0" managedRuntimeVersion="v4.0">
    <processModel identityType="NetworkService" loadUserProfile="true" setProfileEnvironment="true" />

Hope this helps someone