Error while creating event reciever in SharePoint 2010
-
06-12-2019 - |
Pergunta
I am working on creating the event receiver in SharePoint 2010. When I create a new--> project--> event receiver, I choose the sandbox solution and hit ok.
I am getting the following error
"Cannot connect to the SharePoint site: http://servername/. Make sure that this is a valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project."
I get this error all the time when I create any SharePoint solution and deploy it. So usually I will just go inside the proj folder and change this 'projname.csproj.user' file's tag <SharePointSiteUrl>http://servername/</SharePointSiteUrl>
to <SharePointSiteUrl>http://sitename/</SharePointSiteUrl>
and from then on it works fine.
But this time for event receiver, I'm getting that error and when I look into the project folder its empty. I'm not sure how to work around this scenario.
Solução
make sure that when your go new -> project -> event receiver , then paste in your url for debugging http://site.com/sitetest/Home.aspx delete the "Home.aspx" or what ever it may be named, so it ends up as "http://site.com/sitetest/"... also, I'm sure that you have SharePoint installed on the machine, but make sure your permissions are correct.
Outras dicas
Click on your project name in Solution Explorer window.
Then, select View -> Properties Window from the main menu.
Finally, change Site URL property: