Based on the error message, we can see that the problem is probably caused by sql server. There're two things you have to check out. First, check the connection string and ensure it's updated and correct after deployment. Second, check the user used to connect
sql server and ensure it has required permissions. Thanks.
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Yes, but am I wrong in thinking that the same user is used to access the dataset and LINQtoSQL? So if the dataset works fine then, it means that the user has the appropriate permissions and the very same user is used to access the LINQtoSQL. So it would
have to be some problem with LINQtoSQL.
Do I actually only need to change the connection string in the web.config file, nowhere else? Do they both use the same connection string from the same place?
Do I need to change the connection string locally in the project to point to the server before building the project (.dll) in order for that to work? (I've tried that - it failed as well.)
Do I need to change the connection string locally in the project to point to the server before building the project (.dll) in order for that to work? (I've tried that - it failed as well.)
No, you don't need it. After building the dll and deployment, you just need to change the connection string for current sql server with the same name with the one in dll. The project structure should be like that:
dll -- connection string named testConn
project used the dll -- set a new connection string named
testConn
after deployment -- change the testConn in the project with current sql server path
Thanks.
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
I have done this (more than once). This definitely DOES NOT work for me. Like I said, I've done that and it works fine with data sets. It does not work with LINQ to SQL. Like I said, I've got a single connection string, I've got 2 pages (in the same
website) that get deployed to the server - one uses data sets, the other uses LINQ to SQL. Upon deployment, the page with the dataset works fine after changing the connection string to point to the server (rather than my local machine), but the LINQ to SQL
page fails. If I change the connection string to make it invalid, the dataset fails (as it should), if I change it back to make it correct, the dataset works fine again, but still LINQ to SQL fails.
I think I'm becoming rather disillusioned with LINQtoSQL (and entities). I defintely prefer developing with it but that's pointless if deployment is unworkable.
That is strange since you've specified a new connection string with the same name to override the one in dll. It tests OK on my machine. Please send some details to me via
v-weqian@microsoft.online.com(remove "online.") so that I can help to check it. Thanks.
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
the .sql file creates a new DB (called demo) with a single table in it (called demo) with 10 rows in (with text, "text1"-10).
Oh, this was done with and deployed to SQL Server 2005.
You may (obviously) need to change the location to which to create the DB if your SQL Server (2005 [but I don't see why it should work fine on 2008]) installation is not in the default location.
The website is copied as deployed on the server.
The server is Windows Server 2003
You'll obviously need to change the connection string in the web.config file to match.
For deployment, I:
created a new virtual directory to the demoWebsite folder
Created a new appPool (optional I suppose).
Ran the .sql script to create the DB
then just pointed my browser to the demoWebsite location on the server.
I have included the project containing the LINQ to SQL for completeness.
<div>As before, everything works fine on my local machine (Windows Vista Ultimate). Deployed it to the server and the tested. The dataset example works fine. The LINQ to SQL example fails.</div> <div> </div>
<div>This may be viewed here:
http://www.vptol.co.uk/demoWebsite/default.aspx</div> <div> </div>
Wencui Qian ...
All-Star
56784 Points
5796 Posts
Microsoft
Re: Use and Deployment of LINQtoSQL
Oct 01, 2010 06:23 AM|LINK
Based on the error message, we can see that the problem is probably caused by sql server. There're two things you have to check out. First, check the connection string and ensure it's updated and correct after deployment. Second, check the user used to connect sql server and ensure it has required permissions. Thanks.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
Berris
Member
67 Points
41 Posts
Re: Use and Deployment of LINQtoSQL
Oct 01, 2010 10:52 AM|LINK
Yes, but am I wrong in thinking that the same user is used to access the dataset and LINQtoSQL? So if the dataset works fine then, it means that the user has the appropriate permissions and the very same user is used to access the LINQtoSQL. So it would have to be some problem with LINQtoSQL.
Do I actually only need to change the connection string in the web.config file, nowhere else? Do they both use the same connection string from the same place?
Do I need to change the connection string locally in the project to point to the server before building the project (.dll) in order for that to work? (I've tried that - it failed as well.)
Wencui Qian ...
All-Star
56784 Points
5796 Posts
Microsoft
Re: Use and Deployment of LINQtoSQL
Oct 04, 2010 08:10 AM|LINK
No, you don't need it. After building the dll and deployment, you just need to change the connection string for current sql server with the same name with the one in dll. The project structure should be like that:
dll -- connection string named testConn
project used the dll -- set a new connection string named testConn
after deployment -- change the testConn in the project with current sql server path
Thanks.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
Berris
Member
67 Points
41 Posts
Re: Use and Deployment of LINQtoSQL
Oct 04, 2010 08:41 AM|LINK
Hi Wencui Qian;
I have done this (more than once). This definitely DOES NOT work for me. Like I said, I've done that and it works fine with data sets. It does not work with LINQ to SQL. Like I said, I've got a single connection string, I've got 2 pages (in the same website) that get deployed to the server - one uses data sets, the other uses LINQ to SQL. Upon deployment, the page with the dataset works fine after changing the connection string to point to the server (rather than my local machine), but the LINQ to SQL page fails. If I change the connection string to make it invalid, the dataset fails (as it should), if I change it back to make it correct, the dataset works fine again, but still LINQ to SQL fails.
I think I'm becoming rather disillusioned with LINQtoSQL (and entities). I defintely prefer developing with it but that's pointless if deployment is unworkable.
Wencui Qian ...
All-Star
56784 Points
5796 Posts
Microsoft
Re: Use and Deployment of LINQtoSQL
Oct 05, 2010 08:36 AM|LINK
That is strange since you've specified a new connection string with the same name to override the one in dll. It tests OK on my machine. Please send some details to me via v-weqian@microsoft.online.com(remove "online.") so that I can help to check it. Thanks.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
Berris
Member
67 Points
41 Posts
Re: Use and Deployment of LINQtoSQL
Oct 06, 2010 11:27 AM|LINK
Hi Wencui Qian;
I've sent you an email with the details. However, I've got a "not read" receipt back. Just seeking to clarify the situation...
Berris
Member
67 Points
41 Posts
Re: Use and Deployment of LINQtoSQL
Oct 06, 2010 11:41 AM|LINK
Hi All;
I've also put the demo files here for download: http://www.vptol.co.uk/test/downloadtest/demoWebsite.htm
Thanks...
Berris
Member
67 Points
41 Posts
Re: Use and Deployment of LINQtoSQL
Oct 06, 2010 11:52 AM|LINK
Hi All;
I should have passed on a bit of covering information as well with the downloadable demo (apologies) which can be (once again) downloaded from:
http://www.vptol.co.uk/test/downloadtest/demoWebsite.htm
- the .sql file creates a new DB (called demo) with a single table in it (called demo) with 10 rows in (with text, "text1"-10).
- Oh, this was done with and deployed to SQL Server 2005.
- You may (obviously) need to change the location to which to create the DB if your SQL Server (2005 [but I don't see why it should work fine on 2008]) installation is not in the default location.
- The website is copied as deployed on the server.
- The server is Windows Server 2003
- You'll obviously need to change the connection string in the web.config file to match.
- For deployment, I:
- created a new virtual directory to the demoWebsite folder
- Created a new appPool (optional I suppose).
- Ran the .sql script to create the DB
- then just pointed my browser to the demoWebsite location on the server.
- I have included the project containing the LINQ to SQL for completeness.
<div>As before, everything works fine on my local machine (Windows Vista Ultimate). Deployed it to the server and the tested. The dataset example works fine. The LINQ to SQL example fails.</div> <div> </div> <div>This may be viewed here: http://www.vptol.co.uk/demoWebsite/default.aspx</div> <div> </div>