简体   繁体   English

如何使用WSP将Asp.net Web应用程序部署到Sharepoint 2010网站

[英]How do I deploy an Asp.net web application to a Sharepoint 2010 site using WSP

Suppose I created a custom web application that consists of: 假设我创建了一个包含以下内容的自定义Web应用程序:

  • several assembly DLLs: web app, business logic, data services 几个程序集DLL:Web应用程序,业务逻辑,数据服务
  • multiple aspx pages and ascx custom controls that use them 多个aspx页面和使用它们的ascx自定义控件
  • custom configuration section 定制配置部分
  • custom HTTP module 自定义HTTP模块

More or less the usual stuff. 或多或少是平常的东西。

I would like to deploy it to a particular sharepoint site under a certain subfolder. 我想将其部署到某个子文件夹下的特定共享点站点。 So if I access my sharepoint site via http://myserver:90/ (because I'm not using sites/some_site) I'd like my application to be available under http://myserver:90/webapp 因此,如果我通过http:// myserver:90 /访问共享点站点(因为我没有使用site / some_site),我希望我的应用程序可以在http:// myserver:90 / webapp下使用

I could manually add a virtual folder (not application because I would need to access some Sharepoint site's data) to my sharepoint site in IIS and manually edit site's web.config file to register my HTTP module and add my custom configuration section as well either putting my DLLs into GAC or put them in the _app_bin (so I don't have problems with CAS), but I don't think that's a good thing to do, because this web application may get deployed in an environment where this shouldn't/couldn't be possible. 我可以手动将虚拟文件夹(不是应用程序,因为我需要访问一些Sharepoint站点的数据)添加到IIS中的我的sharepoint站点,然后手动编辑站点的web.config文件以注册我的HTTP模块并添加我的自定义配置部分,或者将我的DLL放入GAC或放在_app_bin中(因此我在CAS上没有问题),但是我认为这不是一件好事,因为此Web应用程序可能会部署在不应这样做的环境中/不可能。

So I figured I could build a WSP using Visual Studio 2010 and deploy it that way. 因此,我认为可以使用Visual Studio 2010构建WSP并以这种方式进行部署。 But I don't have enough experience doing that. 但是我没有足够的经验。

I created a new sharepoint 2010 project. 我创建了一个新的SharePoint 2010项目。 Is there a way I could add all non-executable application files (aspx, ascx) at once? 有没有一种方法可以一次添加所有不可执行的应用程序文件(aspx,ascx)? I've seen the advanced tab of the WSP package where I can add my DLLs either to bin folder or GAC. 我已经看到了WSP软件包的高级选项卡,可以在其中将我的DLL添加到bin文件夹或GAC。 I don't know whether I would also have to add any safe control and register certain classes? 我不知道我是否还必须添加任何安全控制并注册某些类?

So I suppose I need some pretty detailed and explanatory guidance here. 因此,我想在这里需要一些非常详细和说明性的指导。

The only real way to do this would be to use the layouts folder to deploy your application via the wsp. 唯一的真正方法是使用布局文件夹通过wsp部署应用程序。 This will let you depot any files that you would normally deploy with a.web application. 这将使您可以存放通常使用.web应用程序部署的所有文件。

There are couple of problems however. 但是有几个问题。 The URL for your application will be http://SharePoint/somesite/_layouts/yourapp 您的应用程序的URL为http:// SharePoint / somesite / _layouts / yourapp

This is a blessing and a curse. 这是一种祝福和诅咒。 Your urls will be ugly but they will work under every SharePoint site. 您的网址很丑陋,但可以在每个SharePoint网站下使用。 If your application depends on SharePoint context to function, that context will automatically be available based on the requesting URL. 如果您的应用程序依赖于SharePoint上下文来运行,则该上下文将根据请求的URL自动可用。

To add a layouts folder under your share point project right click on the project and add a mapped folder to layouts. 要在共享点项目下添加布局文件夹,请右键单击该项目,然后将映射的文件夹添加到布局。 I would also recommend adding a sub folder under layouts for your application so that your application files don't conflict with the default files directly in the layouts folder. 我还建议您在应用程序的布局下添加一个子文件夹,以使您的应用程序文件不直接与布局文件夹中的默认文件冲突。

For the http module, or any web.config modifications, you can use the spwebconfigmodification class. 对于http模块或任何web.config修改,可以使用spwebconfigmodification类。

Heres a walkthru: http://sharepointsolutions.blogspot.com/2006/12/using-spwebconfigmodificat_116736917110571614.html 继承人: http ://sharepointsolutions.blogspot.com/2006/12/using-spwebconfigmodificat_116736917110571614.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM