Error - Cannot contact site at the specified URL. There is no Web named "*.asmx"

21,903

Solution 1

The problem you are having is that your site path is not specified correctly.

instead of

string siteUrl = @"http://servername/sites/subfolder/default.aspx";

try

string siteUrl = @"http://servername/";

if that doesnt work, use whatever address you can enter into your browser of choice to get the site to load.

Solution 2

There must be some error code statement in web.config of your application.

Try changing SessionState mode from InProc to SQLServer.

example:

comment this in your web.config

<sessionState mode="InProc" cookieless="AutoDetect" timeout="20" />

and use something like this in your web.config as per your database

<sessionState mode="SQLServer" timeout="60" allowCustomSqlDatabase="true" sqlConnectionString="Data Source=db;Initial Catalog=MyTestDB_j34b37c3674f46afa09chgsd278a35fa;Integrated Security=True;Enlist=False;Connect Timeout=15" />
Share:
21,903
Dharmendra Kumar Singh
Author by

Dharmendra Kumar Singh

Updated on July 17, 2022

Comments

  • Dharmendra Kumar Singh
    Dharmendra Kumar Singh almost 2 years

    I am trying a read all the documents folder and subfolder from a share point website using Microsoft.SharePoint.Client.dll. This is the code which i am using for this:-

    static void Main(string[] args)
            {
            string siteUrl = @"http://servername/sites/subfolder/default.aspx";
            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;
            FolderCollection collFolder = site.Folders;
            clientContext.Load(collFolder);
            clientContext.ExecuteQuery();
            Console.WriteLine("The current site contains the following folders:\n\n");
            foreach (Folder myFolder in collFolder)
                Console.WriteLine(myFolder.Name);
            }
    

    While debugging i am getting the below error on clientContext.ExecuteQuery(); code. Error-

    Cannot contact site at the specified URL http://servername/sites/subfolder/default.aspx. There is no Web named "/sites/subfolder/default.aspx/_vti_bin/sites.asmx".

    Please help me to fix this as i am new to the sharepoint and already googled alot on this error but not able to fix it.

    Thanks in Advance for all the Coders .