在IIS中添加MIME类型

Since IIS v6 disables requests to .tmp files, if you are using Visual Studio .NET Version 7.0.nnnn you need to define a MIME type in IIS before you can create a custom Web application on a SharePoint Web site through the Visual Studio .NET IDE. To define the MIME type, perform the following steps:

  • On the Windows Start menu, point to Administrative Tools and click Internet Information Services (IIS).
  • In the left pane of the Microsoft Management Console, expand the branches of the console tree.
  • Right-click Web Sites and click Properties on the shortcut menu that appears.
  • In the Web Sites Properties dialog box, select the HTTP Headers tab, and click MIME Types.
  • In the MIME Types dialog box, click New.
  • In the MIME Type dialog box, type .tmp in the Extension text box, and type common/type in the MIME type text box.
  • Click OK in each dialog box until you exit the Web Sites Properties box.

创建一个Web application

Creating a Web application in Visual Studio .NET from a remote computer involves an extra step in the procedure required for creating a Web application in Visual Studio .NET when it is installed on the server that is running Windows SharePoint Services. To create a custom Web application within the context of a SharePoint deployment, perform the following steps:

  • On the File menu, point to New and then click Project.
  • In the New Project dialog box, select Visual Basic Projects or Visual C# Projects in the Project Types box, depending on which language you prefer.
  • In the Templates box, select ASP.NET Web Application.
  • In the Location box type the following path:

    http://Server_Name/_layouts/Web_Application_Name

    This path includes the name of your server, the layouts directory (_layouts), and the name of your custom Web application. Creating the custom application in the _layouts directory makes the project accessible to all sites on the server.

    Note  To create a Web application on the administrative port of the deployment, type the following path: http://Server_Name:Administrative_Port_#/Web_Application_Name

  • Click OK.

    At this point, if you are working from a remote computer, a Web Access Failed dialog box appears, telling you that the file path does not correspond to the URL you previously specified in the New Project dialog box. Perform the following steps:

    • Under What would you like to do?, ensure that Retry using a different file share path is selected and type the following path in the Location box:

      \\Server_Name\Local_Drive$\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\LAYOUTS\Web_Application_Name

      Note  Type the following path to create an application on the administrative port: \\Server_Name:Administrative_Port_#\Local_Drive$\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\ADMIN\1033\Web_Application_Name

    • Click OK.

添加Windows SharePoint Services assembly引用

After creating a new project, add a reference to the Windows SharePoint Services assembly in order to implement Intellisense features in the Object Browser and Code Editor. The process for setting a reference varies, depending on whether you are using Visual Studio .NET on a remote computer or on the server running Windows SharePoint Services. To add a reference to the assembly, perform the following steps:

  • In Solution Explorer, right-click the References node and click Add Reference on the shortcut menu.

    If you are using Visual Studio .NET on the server, perform the following steps:

    • On the .NET tab of the Add Reference dialog box, select Windows SharePoint Services in the list of components, click Select, and then click OK.

    If you are using Visual Studio .NET on a remote computer, perform the following steps:

    • Click Browse, and in the Select Component dialog box, navigate to the Local_Drive\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\ISAPI folder on the server running Windows SharePoint Services. You may instead prefer to first copy Microsoft.SharePoint.dll from this folder to a local drive on the remote computer and then open this local copy of the DLL in the Select Component dialog box.
    • Select Microsoft.SharePoint.dll and then click Open.
    • In the Add Reference dialog box, click OK.