SharePoint 2010 BDC Model Deployment Issue: “The default web application could not be determined.”

Yesterday I tried to deploy a Business Data Connectivity Model project created in Visual Studio 2010 to my SharePoint 2010 test server (all RTM versions), but during the deployment of the solution, SharePoint threw my following error:

Add Solution:
  Adding solution 'BCSDemo2.wsp'...
  Deploying solution 'BCSDemo2.wsp'...
Error occurred in deployment step 'Add Solution': The default web application could not be determined. Set the SiteUrl property in feature BCSDemo2_Feature1 to the URL of the desired site and retry activation.
Parameter name: properties

A little bit of searching on the internet taught me that I was not the only one having this issue, actually Paul Andrew describes how to solve it in this post. Although Paul describes what to do, his explanation is not, let’s say, very elaborate. :-) So let’s describe the steps a little bit more in detail:

  1. Create a new Business Data Connectivity Model project in Visual Studio 2010 and (optionally) implement all your code, change the model etc. When you try to deploy you get the error mentioned above.
  2. To fix it, in the Solution Explorer, navigate to and open the Feature1.Template.xml file (the name could be different if you decided to give your feature a different name of course).
  3. Add the following XML in the Feature element that’s already there (replace the Value with the URL of your site of course):
      <Properties>
        <Property Key='SiteUrl' Value='http://spf.u2ucourse.com'/>
      </Properties>

    The resulting XML should look like:

    <?xml version="1.0" encoding="utf-8" ?>
    <Feature xmlns="
    http://schemas.microsoft.com/sharepoint/">
      <Properties>
        <Property Key='SiteUrl' Value='http://spf.u2ucourse.com'/>
      </Properties>
    </Feature>
  4. Deploy the solution, now without any issues. :-)

What happens now, is that when Visual Studio creates the SharePoint Solution (the WSP file), it will use the Feature template XML to generate the Feature manifest, which will now include the missing property.

4 Comments

  • nice share, good

    article, very usefull for me...thank you

  • great solution......
    I am new to 2010 but have knowledge with 2007
    i checked at http://www.hibuddyz.com/forum/ but there is solution for 2007, not 2010.
    ..
    ..
    Thanks

  • Hello,
    i have nearly the same Problem. I have a Farm-Scoped BCS Feature but it is part of a SiteTemplate.
    The idea behind this is that everyone can deploy my SiteTemplate including the BCS-Features (and some additional stuff).

    But my problem is that i have not idea how to determine the current WebApplication/SiteUrl dynamically.

    I have already tried to use things like ~site and ~sitecollection.

    Do you have any idea what i could do?

    THANKS!

  • Adding this siteurl is an issue because when you want to distribute this to your customers -
    the problem is when i change my servers - i have to repackage the wsp with the correct new site url - any workarounds for this?

Comments have been disabled for this content.