开发者

WebApplication at "site url" coul not be found

开发者 https://www.devze.com 2023-03-15 10:40 出处:网络
i have made window application, which checks new announcements on sharepoint 2007 site, if any new announcemnt is found it shows it as link in my win application.

i have made window application, which checks new announcements on sharepoint 2007 site, if any new announcemnt is found it shows it as link in my win application. application is running fine on my server machine, but when i try to run my window application from normal machine it gives me:

System.IO.FileNotFoundException: The Web application at http://Server-Name:Port-Num/lists/announcements/Allitems.asp开发者_如何学Pythonx 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.

this machine exists on LAN, as i can access site from my browser, but when it comes to win application it gives me the above error on following line:

string rawurl = "http://192.168.1.105:1625/";
SPSite site = new SPSite(rawurl);  // this line gives error


It should throw an exception because the Server Object Model you are using like SPSite, SPWeb will not work unless it's on the server either web application or windows application.

If you want to get data from a remote sharepoint server you should use SharePoint Web Services.

This article will help you http://www.infoq.com/articles/swanson-moss-web-services References:

  • http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/570a4734-d11e-4385-bb97-8625013ebe99/
  • http://objectmix.com/sharepoint/296959-object-model-new-web-site-creation-remote-sharepoint-server.html


make sure the alternate access mapping is correctly set

so if you can call a page with multiple name (machine name and alias like xxxx73 and portauat) note that may only one works in visual studio so try to fix mapping in central admin or call the page with default main url.

for me noting this small tip, fix my problem in my Sharepoint 2010 UAT environment

0

精彩评论

暂无评论...
验证码 换一张
取 消