开发者

When i run web based application i.e. configured with the IIS then it gives connection related error

开发者 https://www.devze.com 2023-02-28 17:48 出处:网络
Hi I have created web based application. I configure with IIS but when its run under iis then it gives error:

Hi I have created web based application. I configure with IIS but when its run under iis then it gives error:

System.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

But its running on local machine correctly.

Whats the problem? Should i change my connection string in Web.config?

Thank you.

<appSettings>
    <add key="ConnectionString" value="Data Source=.\SQLEXPRESS;AttachDbFilename=D:\NewOnlineExamDemo25\App_Data\OnlineQuiz.­mdf;Integrated Security=True;User Instance=True"/>
    <add key="Delay" value="1800000" />
</appSettings>
<connectionStrings>
    <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=D:\NewOnlineExamDemo25\App_D开发者_JS百科ata\OnlineQuiz.­mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings>


Check your web.config file for the setting of 'Identity impersonate'. Probably it'll be enough to use the following

    <identity impersonate="false"/> 


The problem is in your connection string:

 value="Data Source=.\SQLEXPRESS;AttachDbFilename=D:\NewOnlineExamDemo25\App_Data\OnlineQuiz.­

On the server I don't think that this path; D:\NewOnlineExamDemo25\App_Data\OnlineQuiz exists. You have to attach the DB to your SQL server and then set that information in your connection string.

0

精彩评论

暂无评论...
验证码 换一张
取 消