.NET Console connect to STS over SSL?

  • Thread starter Thread starter Jennifer
  • Start date Start date
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();
}
 
Hi Jennifer,

Thanks for your post. I will ask one who is expertise on SharePoint Server
to check this issue and reply to this thread.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
We are working with Jennifer offline to reproduce this problem.

John Eikanger
Microsoft Developer Support
--------------------
| From: (e-mail address removed) (Tian Min Huang)
| Organization: Microsoft
| Date: Wed, 26 Nov 2003 07:51:57 GMT
| Subject: RE: .NET Console connect to STS over SSL?
| Newsgroups: microsoft.public.dotnet.general
|
| Hi Jennifer,
|
| Thanks for your post. I will ask one who is expertise on SharePoint
Server
| to check this issue and reply to this thread.
|
| Have a nice day!
|
| Regards,
|
| HuangTM
| Microsoft Online Partner Support
| MCSE/MCSD
|
| Get Secure! -- www.microsoft.com/security
| This posting is provided "as is" with no warranties and confers no rights.
|
|
 
Hello Jennifer,
I am investigating this case and had sent you an email earlier I am not
sure if you received that.
I had a couple questions for you regarding your environment.
1. Is this application running on the server itself?
2. Can you describe in a little detail how your ssl set up is and the steps
you take then you say you run it over SSL.

This will help me recreate the problem here and debug it.
One thing to try will be to get a netmon trace while running your
application and see what user you are running your application as in the
SSL environment and if the right user is getting passed across.

Let me know if you have any further questions regarding this at any time.
Thanks

Rohit Puri
Microsoft.
 
Back
Top