Поделиться через


How to Create a Commerce Server Application in Visual Studio

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

You can create a Commerce Server application in one of the following ways 

  • You can use the Commerce Server Project Wizard in Microsoft Visual Studio to create a new Commerce Server application as a Web Service Project (WSP).

  • You can convert an existing WSP site into a Commerce Server application.

Note

Commerce Server does not provide a Web Application Project template for Microsoft Visual Studio. To use this project type, you must convert a WSP Commerce Server application to a Web Application Project (WAP). For a complete description of the Microsoft Visual Studio Web Application Project, see https://go.microsoft.com/fwlink/?LinkId=86316.

The Commerce Server applications that are created by using these procedures can be based on either Visual Basic or C#.

To create a new Commerce Server application as a WSP

  1. Click Start, point to Programs, point to Microsoft Visual Studio 2005 or Visual Studio 2008, and then click Microsoft Visual Studio 2005 or Visual Studio 2008.

  2. On the File menu, point to New, and then click Web Site.

  3. In the Language field of the New Web Site dialog box, select Visual Basic to create a Commerce Server Web site by using Visual Basic, or select Visual C# to create a Commerce Server Web site by using Visual C#.

  4. In the Templates section, under Visual Studio installed templates, select Commerce VB ASP.NET Web Application if you selected the Visual Basic language, or Commerce C# ASP.NET Web Application if you selected the C# language.

  5. Select HTTP in the Location field, and either type the URL of the location where you want to save the Web site, or use the Browse button to move to the path where you want to save the Web site.

    Note

    The location must start with "https://localhost/". By selecting HTTP in the Location field and specifying an HTTP path instead of a file system path, you are opting to use Internet Information Services (IIS) as your Web server. This is required. You cannot create a Commerce Server Web site as a Visual Studio file system Web site.

  6. In first page of the Commerce Server Project Wizard, click Next.

  7. On the Quick Unpack page, select the name of the IIS Web site where the applications will be installed.

  8. In the Databases section, in the SQL Server Computer field, type the name of the computer where the site databases will be installed. This computer must be running Microsoft SQL Server.

  9. Select the type of SQL Server security to use:

    • To use Windows Integrated security, select Use Windows Integrated security.

      When you use Windows Integrated security, user names and passwords are not stored in the SQL Server connection string and are not affected by SQL Server password resets.

    • To use SQL Server authentication, select Use a specific user name and password, and enter the SQL Server logon name and password.

      Note

      For security purposes, do not use the "sa" logon for access to the databases. To change the logon information for the Administration database after it is created, use SQL Server Enterprise Manager.

  10. Click Next.

    Visual Studio starts the Commerce Server Site Packager to begin unpacking your Web site and creating the new project. This might take several minutes.

  11. On the first Profiling System page, either accept the default profile, site terms, and expressions definitions, or enter the paths of the XML files that provide your custom definitions, and then click Next.

  12. On the second Profiling System page, either accept the default connection string, or enter a new connection string to the profiles database.

  13. Either accept the default script to define the profiles schemas, or enter the path of your own script to define the profiles schemas.

  14. If you want to populate the profiles database, enter the path of the script that populates the database.

  15. Click OK.

    The Commerce Server Site Packager continues unpacking your Web site and creating the new project. This might take several minutes.

  16. Click OK in the Commerce Server Site Packager dialog box to acknowledge that the database connection strings have been created.

To convert an existing WSP site into a Commerce Server application

  1. Click Start, point to Programs, point to Microsoft Visual Studio 2005 or Visual Studio 2008, and then click Microsoft Visual Studio 2005 or Visual Studio 2008.

  2. On the File menu, point to New, and then click Web Site.

  3. In the Language field of the New Web Site dialog box, select Visual Basic if the existing Web site is based on Visual Basic, or select Visual C# if the existing Web site is based on C#.

  4. In the Templates section, under Visual Studio installed templates, select Commerce VB ASP.NET Web App (if you selected the Visual Basic language) or Commerce C# ASP.NET Web App (if you selected the C# language).

  5. Select HTTP in the Location field, and either type the URL of the existing Web site, or use the Browse button to move to the existing Web site.

    Note

    The Web site that you are converting into a Commerce Server application must be located in an immediate subfolder of the default folder for the IIS Web site (for example, c:\Inetpub\wwwroot).

    Note

    The location must start with "https://localhost/". By selecting HTTP in the Location field and specifying an HTTP path instead of a file system path, you are opting to use IIS as your Web server. This is required. You cannot create a Commerce Server Web site as a Visual Studio file system Web site.

  6. In first page of the Commerce Server Project Wizard, click Next.

    The Web Site Already Exists dialog box will appear.

  7. In the Web Site Already Exists dialog box, select the Open the existing Web site option, and then click OK.

  8. On the Quick Unpack page, select the name of the IIS Web site where the applications will be installed.

    Note

    Make sure that you specify the same Web site in this step as you did in step 5 of this procedure.

  9. In the Databases section, in the SQL Server Computer field, type the name of the computer where the site databases will be installed. This computer must be running Microsoft SQL Server.

  10. Select the type of SQL Server security to use:

    • To use Windows Integrated security, select Use Windows Integrated security.

      When you use Windows Integrated security, user names and passwords are not stored in the SQL Server connection string and are not affected by SQL Server password resets.

    • To use SQL Server authentication, select Use a specific user name and password, and enter the SQL Server logon name and password.

      Note

      For security purposes, do not use the "sa" logon for access to the databases. To change the logon information for the Administration database after it is created, use SQL Server Enterprise Manager.

  11. Click Next.

    Visual Studio starts the Commerce Server Site Packager to begin unpacking your Web site and creating the new project. This might take several minutes.

  12. On the first Profiling System page, either accept the default profile, site terms, and expressions definitions, or enter the paths of the XML files that provide your custom definitions, and then click Next.

  13. On the second Profiling System page, either accept the default connection string, or enter a new connection string to the profiles database.

  14. Either accept the default script to define the profiles schemas, or enter the path of your own script to define the profiles schemas.

  15. If you want to populate the profiles database, enter the path of the script that populates the database.

  16. Click OK.

    The Commerce Server Site Packager continues unpacking your Web site and creating the new project. This might take several minutes.

  17. Click OK in the Commerce Server Site Packager dialog box to acknowledge that the database connection strings have been created.

How to Convert to the Web Application Project Type

Commerce Server 2007 does not provide a template for creating the Microsoft Visual Studio Web Application Project. To use this project type, create a Commerce Server application as a WSP project and convert it to a WAP project. You can also convert an existing Commerce Server application to a WAP project. For a description of the Microsoft Visual Studio Web Application Project and instructions for how to create a project, see https://go.microsoft.com/fwlink/?LinkId=8631.

To convert a Commerce Server application to a Web Application Project

  1. Create a new Commerce Server WSP application by following the instructions given previously in this topic. You can also open an existing WSP project. To do this click Start, point to Programs, point to Microsoft Visual Studio 2005 or Visual Studio 2008, and then click Microsoft Visual Studio 2005 or Visual Studio 2008. Then, on the File menu, point to Open, and then click Web Site. Select the Commerce Server application.

  2. In the same solution, create a new WAP application. To do this, on the File menu, point to Add and select New Project. For information about how to create a Web Application Project, see https://go.microsoft.com/fwlink/?LinkId=8631.

  3. In Solution Explorer, remove the web.config file and the default.aspx file from the WAP project.

  4. Copy all files from the Commerce Server WSP application to the WAP project. To do this, in Solution Explorer, select all the files in the Commerce Server WSP application. Then copy and paste them into the WAP project.

  5. Right-click the root node of the WAP project and select Convert to Web Application.

  6. Follow the instructions on https://go.microsoft.com/fwlink/?LinkId=8631 to build and run your WAP project.

See Also

Other Resources

Accessing the Commerce Server Tools from within Visual Studio

Developing Commerce Server Applications with Visual Studio