Install SharePoint 2010 Without a Domain on a Single Server

I was trying to create a virtual machine for development with SharePoint 2010, but I wanted to have a full SQL Server available instead of using the standalone installation with SQL Express. Unfortunately, this situation is not supported unless you are using domain accounts. My VPC is not part of any domain, so the install won’t proceed (which is by design apparently). There is a well-documented workaround using the New-SPConfigurationDatabase PowerShell script, so I tried that.  That seemed to work, it ran for a while, but then I ended up with an error:

User does not exist or is not unique

I found a post on the MSDN Forums that had the right answer. When the script prompted me for credentials, I put in a local username and password, and this was accepted. Until later when the script crashed. It turns out that I needed machinename\username and password. Even though the authentication prompt accepted the credentials without the machinename, somewhere down the line the script needed the machinename and it wasn’t there. Another important item to note was that once the PowerShell script crashed, it would no longer work even if you got all the prompts correct. I needed to exit the script shell and start again.

Posted: Tuesday, July 27, 2010 12:53:11 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
SharePoint | Strange Problems

Connecting to TFS 2010 with Visual Studio 2008

I got error TF31002 when trying to connect to TFS 2010 with Visual Studio 2008:

TF31002 The Team Foundation Server name, port number or protocol is incorrect The Team Foundation server is offline Password is expired or incorrect.

The basic problem is that in Team Explorer, before Visual Studio Service Pack 1, you can’t enter a valid URL in the Add Team Foundation Server dialog, only a server name or IP address. Unfortunately TFS 2010 changed the URL of the server to this format: http://<servername>:<port>/tfs/, adding a virtual directory that TFS 2008 does not have. Pre sp1 this syntax is not allowed in the dialog box. Just putting in the server name produces the above error, which, in the irritating way that error messages work, is completely correct since the services can’t be found because they now reside in a virtual directory.

To get Visual Studio 2008 to connect to Team Foundation Server 2010, there are definitely some steps you need to follow. I found a bunch of mostly correct information, but nothing exactly right (beta and RC were widely available) so I figured I’d post it here.

To begin with, you need to install the following, in this order to Visual Studio 2008:

  1. Team Explorer for TFS
  2. Visual Studio 2008 sp1
  3. Visual Studio Team System 2008 Service Pack 1 Forward Compatibility Update for Team Foundation Server 2010

If you already installed Service Pack 1 and need install Team Explorer, you will need to re-apply the service pack.

Enter the URL like this:

http://<servername>:<port>/tfs/

Add a TFS Server

Now you should be good to connect to the server.

Posted: Wednesday, June 09, 2010 10:10:10 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
Strange Problems | TFS | Visual Studio

Creating VPC Networks using Windows 7 as Host

I just want to track these two great posts on how to set up a virtual private network for hosting one or more virtual machines where you may not have an actual network connection. This happens to me when I’m giving presentations (like my upcoming one at Day of .Net!) and the host and guest machines need to be able to talk to one another, even if the host machine is not on any network.

Windows Virtual PC: Network Between Host and VM Using Loopback Adapter

Windows 7 & Network Loopback Adapter Settings

Posted: Wednesday, April 28, 2010 12:10:24 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
Speaking | Strange Problems | Tools

Casting a Null

Found an interesting tidbit today. There is an ASP.NET page that is using session variables. The user has visited the page, and populated the session. But then the user lingers, and the session times out on a page that is not protected. The user then clicks a button, and the following line of C# code executes:

User foo = (User)Session[“bar”];

So what should happen here? An Exception? That’s what I would have thought. But not true. Since the session has expired, the session variable is now null, and you can cast a null into another data type having a value of null. Just as long as that type is nullable. So the line above is the same as:

User foo = (User)null;

which is perfectly valid.

I got the null reference exception down the line when trying to access a property of foo. So once again, defensive programming is the rule. Check your session variables for null!

Posted: Thursday, July 16, 2009 9:14:00 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
.Net 2.0 | .Net 3.5 | Strange Problems

Commerce Server 2007 Customer and Orders Payment Method Error

Right off I just want to say it sucks when the error message is correct but you don't understand why.

We needed to add a new payment method to a Commerce Server 2007 implementation. The Customer and Orders UI threw an error immediately when going to manage Payment methods:

The underlying table was full of data. The site has been in production for over a year, collecting credit card payments the whole time without issues. Obviously the payment methods weren't missing.

Of course, Googling was no help whatsoever. I played with the Commerce API, wrote some code, ran SQL traces, all to no avail.

So on the a non-production version of the site (with the same problem luckily), I decided to work on the database table directly. I scripted off the original data, and truncated the table. Now the UI doesn't throw the error. So I re-added the data manually, and again the UI is fine, no errors.

So I compared the newly entered data with the old data, and there was a difference (outside of the obvious differences like keys). There is a bit column in the table called IsDefault. In the old data, all rows except one were set to False. In the new data, all rows were set to True. To test that this was the problem, I truncated the table again, and re-inserted the original data. Then I changed the IsDefault values to True on all the rows. Bingo. The UI now works again, and I could add the new data. So apparently someone did modify the data in the past, and the error message was correct about the database being tampered with. Luckily this modification had not affected Commerce Server's ability to process credit cards.

I think the IsDefault column refers to the language setting for the row in the table, as you can have multiple language variants for a credit card and choose which one is the default language. So for the UI to function properly, at least one row for each language needs to have IsDefault set to True.

Posted: Monday, February 02, 2009 11:01:49 AM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
Commerce Server | Strange Problems

Technical Irony

While looking for a URL rewriting tool for a client I found a reference to a tool, clicked the link and got a 404 error.

Posted: Saturday, January 26, 2008 6:02:27 AM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
Strange Problems

CopySourceAsHTML Clipboard Access Error (Blame the VPC)

I kept getting an error when trying to use CopySourceAsHTML in Visual Studio 2005. The error was that CopySourceAsHTML was unable to access the clipboard. Turns out the problem is when using it in a VPC, and the answer is here.
Posted: Monday, January 15, 2007 10:11:51 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
Strange Problems | Visual Studio

Virtual PC SourceSafe Network Problem

We have been using Virtual PCs to host a separate development environment. Some of the team members have been having sporadic network issues with SourceSafe on the Virtual PCs. They were unable to get all of the projects involved down to the Virtual PC without getting a “Network Not Found” error. Eventually they would get all the files, but it was clearly not the best situation.

The Virtual PC image was sysprepped before distributing it, to avoid network problems. Unfortunately, that is not completely the case. Sysprep does reset the MAC address on the Virtual PC, but it apparently happens when sysprep runs, not when the user is re-setting up the PC. After distributing the image, the subsequent users still had the same MAC address. This was causing network problems when more than one person were using the Virtual PCs at the same time. The problem manifested itself mostly with SourceSafe, especially when there was a large change and multiple users were getting all the latest files at the same time.

At least the solution was simple once we realized that the MAC address was the issue (thanks to an astute network admin who had noticed some problems with a particular MAC address on one of the switches). In the .vpc file (it's XML), there is an entry for ethernet address. It contains the MAC address the Virtual PC uses. If you remove the data from the tag, leaving the empty tags, Virtual PC will auto-generate a new MAC address the next time it starts up. Since that change the “Network not Found” error has disappeared.

Posted: Wednesday, February 23, 2005 1:54:57 AM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
Strange Problems

Reloading for the New Year

After a harried development and delivery of a good sized Software Spec document to a client before the holidays, I have tried again to load XP SP2 on my laptop (hp compaq nx5000) without success. Despite updating all the drivers and the ROM before loading SP2, I still get blue screens after the profile loads, but not every time. The plan now is to wipe it out and start from scratch.

Posted: Wednesday, January 05, 2005 7:58:06 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
Strange Problems

Forms Authentication Problem

An ASP.Net site we created is having infrequent problems with logins using forms authentication. Essentially what happens is that the user attempts to login and is successful, but then is redirected back to the login page immediately. So it looks like an infinite loop of logins. We have been able to deduce that the cookie is related to the problem. If the user deletes their cookies in IE the problem goes away. The problem is very intermittent, so it is very difficult to reproduce. It is not generating 500 errors or errors in the logs. From extensive Googling, the best I can come up with is the fact that we allowed the cookie to persist across sessions, and the problem is related to that. So I changed the createPersistentCookie parameter to false:

FormsAuthentication.SetAuthCookie(nResult.ToString, False)

Of course, solving the problem is only a wait-and-see in this case, since I can't reproduce the problem directly. I thought our login code was pretty straightforward, letting ASP.Net do as much of the work as possible.


Imports System.Web.Security.FormsAuthentication
....
.... 'txtEmail, txtPassword are textboxes on the form, lblMessage is a label control Public Sub Login_Click(ByVal snd As System.Object, ByVal e As System.EventArgs) _
Handles LoginButton.Click
Dim NotRegistered As String = " is not a registered email address. “ & _
“Please use the Create A Profile link to register." Dim nResult As Integer
If Page.IsValid Then Dim sPassword As String





sPassword = HashPasswordForStoringInConfigFile(txtPassword.Text, "sha1") nResult = LoginResult(txtEmail.Text, sPassword) 'Validate against the database If nResult = -1 Then 'Not a registered user, display error message lblMessage.Text = txtEmail.Text & NotRegistered ElseIf nResult = -2 Then 'Bad password, set error message lblMessage.Text = "The password for " & txtEmail.Text & _
" is incorrect" ElseIf nResult > 0 Then 'Registered user, nResult is their ID number If Request.QueryString("ReturnUrl") <> "" Then 'Redirect to requsted page RedirectFromLoginPage(nResult.ToString, False) Else 'Go to My Jobs by default SetAuthCookie(nResult.ToString, False) Response.Redirect("../MyJobs/My_Jobs.aspx") End If
End if End If End Sub
Posted: Wednesday, January 07, 2004 1:36:54 PM (Eastern Standard Time, UTC-05:00)  #    Comments - Trackback
.Net 1.1 | ASP.NET | Security | Strange Problems