惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Application and Cybersecurity Blog
Application and Cybersecurity Blog
A
About on SuperTechFans
S
SegmentFault 最新的问题
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Help Net Security
Help Net Security
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
O
OpenAI News
美团技术团队
月光博客
月光博客
Apple Machine Learning Research
Apple Machine Learning Research
Schneier on Security
Schneier on Security
Webroot Blog
Webroot Blog
Cyberwarzone
Cyberwarzone
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
T
Tenable Blog
S
Security Affairs
博客园_首页
S
Schneier on Security
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
T
Tailwind CSS Blog
大猫的无限游戏
大猫的无限游戏
Spread Privacy
Spread Privacy
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
TaoSecurity Blog
TaoSecurity Blog
博客园 - 聂微东
Vercel News
Vercel News
M
MIT News - Artificial intelligence
T
Troy Hunt's Blog
B
Blog
MongoDB | Blog
MongoDB | Blog
Martin Fowler
Martin Fowler
Attack and Defense Labs
Attack and Defense Labs
L
LINUX DO - 最新话题
D
DataBreaches.Net
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - Franky
W
WeLiveSecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
F
Fortinet All Blogs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Check Point Blog
H
Hacker News: Front Page

博客园 - 范文轩

Sharepoint中的Feature Stapling功能 SharePoint 2010中的WebProvisioned Event Handler 如何向列表中添加数据值(开发篇补充REST) 如何向列表中添加数据值(开发篇) 如何向列表中添加数据值(管理员篇) 在SharePoint 2010中动态加载Visio Web Part 使用编程的方式来启动SharePoint的工作流 InfoPath 2010调用REST的一个小应用 SharePoint 2010 WSP包部署过程中究竟发生什么? 如何查看SharePoint 2010的CU版本 SharePoint 2010多语言包的安装 在SharePoint 2010中使用Linq时候,请注意特殊字符 在Infopath 2010中调用Web Service 谈谈SharePoint 2010的客户端对象模型的性能问题 给Document Set里面添加文件夹 给Chart Web Part 添加过滤功能 SharePoint 2010的Form认证的用户注册功能 SharePoint 调查列表的自定义错误页面 Reporting Services 2008 and SharePoint 2010
自定义ASP.NET WebApplication中调用SharePoint2010的对象
范文轩 · 2011-03-16 · via 博客园 - 范文轩

如果你是做SharePoint开发的话,一定不会对如下这段代码陌生:

using(SPSite oSiteCollection = new SPSite("http://Server_Name"))
{
    using(SPWeb oWebsite = oSiteCollection.OpenWeb("Website_URL"))
    {
    
    }
}

你会在自定义webPart, 或者是一个控制台程序中写这段代码。那么你有没尝试过在ASP.NET中写这段代码?譬如说使用SPGridView控件的时候,与其在WebPart中调试,是不是没有在ASP.NET的Web Application中调试方便?

在SharPoint 2007的时候这段代码是可以在Web Application程序中运行的,但是在SharePoint 2010 中,你就没有那么幸运了。在第一行代码中,你得到的就是“web应用程序找不到”(我的是英文环境,错误:The Web application at 'http://Server_Name could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application)

接下来很多的人都会想到,在VS2010中,把Framework换成3.5,以及平台由X86换成“Any CPU”,但是你的问题依旧不会解决。这个方案仅仅适合控制台程序。

结论: IIS Express不完全支持64bit。

论据:http://learn.iis.net/page.aspx/901/iis-express-faq/

Q: Are 64-bit machines supported?

A: The first official release of IIS Express will support 64-bit architectures using the WoW64 subsystem. Full 64-bit support will be considered for future releases.

论证过程:

1.这段代码在调用SharePoint 2007对象的时候可以成功,但是在调用SharePoint 2010的时候失败, 二者主要的区别是后者是64bit的;

2.调用SharePoint2010对象的时候,你在控制台程序中可以成功,在web应用程序中却失败,说明SharePoint 2010的这些对象是可以在外部调用的;

3.如果你将你的web应用程序发布成IIS站点之后,代码是可以运行的。区别:VS2010调试的时候使用的是IIS Express, 而发布的时候是IIS。

解决方案:

如果你想在vs2010创建的Web Application中调试SharePoint 2010 的代码,那么你就的告诉VS2010调试这段代码的时候不要使用默认的服务器,而要使用本地的IIS. 如下图:

image