Friday, September 21, 2012

Entity Framework Certificate Chain Errors

During the process of constructing a data access layer for a SharePoint project I kept running into SSL errors trying to construct my data model using the Entity Framework. I began the project with an Azure database which, surprisingly enough, worked like a champ – Visual Studio 2010 picked right up on my connection string and imported my DB structure without incident. When I tried to switch over to a SQL instance on my development SharePoint farm, however, things took a turn for the worst. Every time I tried to connect to the database in order to generate my model I received the following error:  

"A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 – The certificate chain was issued by an authority that is not trusted.)"

After wasting a bunch of time searching around the interwebs for a solution, it became apparent that the self-signed certificate on the remote SQL instance was the cause of my headaches. Self-signed certs are fine on a local box but no good at all when you try to access the SSL port from a different machine. Trouble is, I couldn't run Visual Studio on the actual server as the Azure components don't play nice with SharePoint, so switching over to the same box with the cert on it wasn't an option. After some fiddling around with the entity framework connection string (not the database connection string), I was able to actually get data from a database that matched the Azure schema on my dev SQL instance by adding "trustServerCertificate=True" to the connect parameters (thanks to Wade Wegner). That was a step in the right direction, proving that VS actually could communicate with SQL regardless of SSL certificates, but I had created a new database schema and needed to generate an entirely new entity model – all attempts to do so were still blocked by the database import wizard on the last step..

Read more from Eric Shupps

Articles

Eric Shupps eshupps SharePoint Cowboy - Ten Steps to Optimize SharePoint Performance

Webcasts

Eric Shupps eshupps SharePoint Cowboy - Secrets of SharePoint Part 5: Configuring Microsoft Office SharePoint Server 2007 for Optimal Performance
Eric Shupps eshupps SharePoint Cowboy - Creating End User SharePoint Solutions for Performance and Scalability
Eric Shupps eshupps SharePoint Cowboy - SharePoint 2010 Performance Enhancements for Administrators
Eric Shupps eshupps SharePoint Cowboy - Microsoft SharePoint Server 2010 for the ASP.NET Developer
Eric Shupps eshupps SharePoint Cowboy - Following Best Practices and Avoiding Common Errors with Microsoft Office SharePoint Server 2007 Development
Eric Shupps eshupps SharePoint Cowboy - SharePoint Performance and Capacity Planning Essentials
Eric Shupps eshupps SharePoint Cowboy - Troubleshooting Common Performance Problems in SharePoint 2010

Videos

Eric Shupps eshupps SharePoint Cowboy - Channel 9 Interview with Eric Shupps
Eric Shupps eshupps SharePoint Cowboy - SharePoint TechTalk - Different Views on Social Computing
Eric Shupps eshupps SharePoint Cowboy - SharePoint Post-Deployment Planning and Management

Podcasts

Eric Shupps eshupps SharePoint Cowboy - SharePoint Pod Show - Design for Performance
Eric Shupps eshupps SharePoint Cowboy - SharePoint Pod Show - Test Driven Development
Eric Shupps eshupps SharePoint Cowboy - Run As Radio - Eric Shupps Improves SharePoint Performance

Eric Shupps eshupps SharePoint Cowboy on ConferenceHound
Eric Shupps eshupps SharePoint Cowboy - Talk TechNet
Eric Shupps eshupps SharePoint Cowboy on Channel 9
Eric Shupps eshupps SharePoint Cowboy on Planet SharePoint
Eric Shupps eshupps SharePoint Cowboy on Lanyrd
Eric Shupps eshupps SharePoint Cowboy MVP Profile
Eric Shupps eshupps SharePoint Cowboy About.me
Eric Shupps eshupps SharePoint Cowboy Tumblr
Eric Shupps eshupps SharePoint Cowboy Speakerfile
Eric Shupps eshupps SharePoint Cowboy Facebook
Eric Shupps eshupps SharePoint Cowboy LinkedIn
Eric Shupps eshupps SharePoint Cowboy Google+
Eric Shupps eshupps SharePoint Cowboy Twitter