J
Jennifer
Hi, I am trying to write a sample console app which
enumerates the lists for a sharepoint team services site.
The site does not allow anonymous and uses windows
integrated security.
My code works fine over "http" but as soon as I try to
address the "https" SSL site, then the initial
SPSite.RootWeb call fails.
By the way, I am using host headers and in the Sharepoint
admin tool the SSL site displays using the machine name
rather than the host header -- don't know if that is a
problem because use of the site is not impacted. There is
only one SSL site on the server. Also, to my knowledge,
the IIS is not running in IIS5 compat mode.
Can someone please help me understand what I need to do
to avoid the following error?
Unhandled Exception: Microsoft.SharePoint.SPException:
The server instance specified was not found. Please
specify the server's address and port.
at Microsoft.SharePoint.g.a(Boolean A_0, String A_1,
Guid A_2, Int32& A_3)
at Microsoft.SharePoint.g.a(Boolean A_0, String A_1,
Guid A_2, Int32& A_3)
at Microsoft.SharePoint.SPSite.k()
at Microsoft.SharePoint.SPSite.get_ServerRelativeUrl()
at Microsoft.SharePoint.SPSite.get_RootWeb()
at ConsoleApplication1.Class1.Main(String[] args) in
c:\visual studio projects\distributors\consoleapplication1
\class1.cs:line 20
Here is my code:
[STAThread]
static void Main(string[] args)
{
SPSite siteCollection = new SPSite
(ConfigurationSettings.AppSettings["url"]);
SPWeb site = siteCollection.RootWeb;
SPList list = site.Lists["Contacts"];
Console.WriteLine("List: " + list.Title);
foreach (SPListItem item in list.Items)
{
Console.WriteLine(item["Title"]);
}
Console.WriteLine("Press ENTER to continue");
Console.ReadLine();
}
enumerates the lists for a sharepoint team services site.
The site does not allow anonymous and uses windows
integrated security.
My code works fine over "http" but as soon as I try to
address the "https" SSL site, then the initial
SPSite.RootWeb call fails.
By the way, I am using host headers and in the Sharepoint
admin tool the SSL site displays using the machine name
rather than the host header -- don't know if that is a
problem because use of the site is not impacted. There is
only one SSL site on the server. Also, to my knowledge,
the IIS is not running in IIS5 compat mode.
Can someone please help me understand what I need to do
to avoid the following error?
Unhandled Exception: Microsoft.SharePoint.SPException:
The server instance specified was not found. Please
specify the server's address and port.
at Microsoft.SharePoint.g.a(Boolean A_0, String A_1,
Guid A_2, Int32& A_3)
at Microsoft.SharePoint.g.a(Boolean A_0, String A_1,
Guid A_2, Int32& A_3)
at Microsoft.SharePoint.SPSite.k()
at Microsoft.SharePoint.SPSite.get_ServerRelativeUrl()
at Microsoft.SharePoint.SPSite.get_RootWeb()
at ConsoleApplication1.Class1.Main(String[] args) in
c:\visual studio projects\distributors\consoleapplication1
\class1.cs:line 20
Here is my code:
[STAThread]
static void Main(string[] args)
{
SPSite siteCollection = new SPSite
(ConfigurationSettings.AppSettings["url"]);
SPWeb site = siteCollection.RootWeb;
SPList list = site.Lists["Contacts"];
Console.WriteLine("List: " + list.Title);
foreach (SPListItem item in list.Items)
{
Console.WriteLine(item["Title"]);
}
Console.WriteLine("Press ENTER to continue");
Console.ReadLine();
}