I have got this error while I am using SAP .NET Connector 3.0 x64. I couldn't find any solution at stackoverflow, so I d like to share here for others who stuck at same problem like me.
In VS 2017 I was able to resolve this by setting the Bitness to "x64" for IIS Express in the server section under the project web properties. I imagine this is similar to making the Use64BitIISExpress Regedit change in one of the other answers.

Run > Regedit
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\1X.0\WebProjects
Change Use64BitIISExpress from 0 to 1 Restart Visual Studio and IISExpress.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With