How To Fix "$(ReplacableToken....") ConnectionString Issue on web.config in Asp.Net

For More Videos Visit Our YouTube Channel



When you specify connection string on the web.config of your web application and trying to publish to IIS, the connection string will be replaced with "ReplacableToken". The new connection string looks like as below. $(ReplacableToken.....-web.config....). The replacement of Connection string will happen to all connection string specified on the web.config. The situation will be like, everything is working fine on localhost but when goes to IIS, the application is not working. You may not be able to track the issue unless you attach the IIS hosted app to the Visual Studio. Those who develop final checklist for deployment, please add this issue as high priority. This happens not only to the Asp.Net app, but any kind of IIS hosted Application.



Please follow the below steps to resolve this Issue. Open your .csproj file on Notepad. Go to the node PropertyGroup. May be there will have more PropertyGroup node as per your Publish environment. For example Debug, Release, Production. Inside PropertyGroup node find the sub node named
AutoParameterizationWebConfigConnectionStrings. Set it as False as shown in the image.

How To Fix ReplacableToken ConnectionString Issue on web.config in Asp.Net

Do this for all publish environment. Save the .csproj file and then republish the Solution to the IIS. This would definitely resolve the issue.