web.config 和 connectionStrings 中的引号 [英] web.config and quotes in connectionStrings
问题描述
我有以下连接字符串,您会注意到Provider's.Tests",注意单引号,我如何将其输入到 web.config 中以使其有效?
I have the following connection string, and you will notice "Provider's.Tests", notice the single quote, how do I enter this in to the web.config to make it valid?
<connectionStrings>
<clear/>
<add name="Provider" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Projects\Provider's.Tests\app_data\db.mdf";Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
推荐答案
我不认为 Provider's
是问题所在,而是路径周围的双引号.
尝试将其删除,使其显示 AttachDbFilename=C:\Projects\Provider's.Tests\app_data\db.mdf;
I don't think its the Provider's
that is the problem, It is the double quotes around the path.
Try to just remove it so it says AttachDbFilename=C:\Projects\Provider's.Tests\app_data\db.mdf;
如果在连接字符串中拥有它很重要,请尝试对其进行编码:AttachDbFilename="C:\Projects\Provider's.Tests\app_data\db.mdf;"
If it is important in the connection string to have it, try encoding it:
AttachDbFilename="C:\Projects\Provider's.Tests\app_data\db.mdf;"
这篇关于web.config 和 connectionStrings 中的引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!