Unexpected response from server. The status code of response is '500'.

Unanswered Unexpected response from server. The status code of response is '500'.

  • Monday, May 28, 2012 10:54 AM
     
      Has Code

    Hi All,

    I am using ECMAScript to pull data from list, it was working 2hrs back but suddenly it is throwing an error : "Unexpected response from server. The status code of response is '500'. The status text of response is 'System.ServiceModel.ServiceActivationException'."

    I ma using this code

    function SearchEmployee() {
            try {
                //this function is used to get get dynamic query
                var tempQuery = GenerateQuery();
                var context = new SP.ClientContext.get_current();
                var web = context.get_web();
                var list = web.get_lists().getByTitle('Employee Information');
                var query = "<View Scope=\'RecursiveAll\'>" +
                        "<Query>";
                query += tempQuery;
                query += "<OrderBy>" +
    	                        " <FieldRef Name='EmployeeFullName' />" +
    	                    "</OrderBy>" +
                        "</Query>" +
                        "<ViewFields>" +
                            "<FieldRef Name='EmployeeFullName' />" +
                            "<FieldRef Name='EmpCode' />" +
                            "<FieldRef Name='ID' />" +
                         "</ViewFields></View>";
                var camlQuery = new SP.CamlQuery();
                camlQuery.set_viewXml(query);
                this.employeeCollection = list.getItems(camlQuery);
                context.load(this.employeeCollection, 'Include(EmployeeFullName,EmpCode,DateOfJoining,DesignationID,UnitID,DOB,ReportingManagerID,ID)');
                context.executeQueryAsync(Function.createDelegate(this, this.success), Function.createDelegate(this, this.failed));
            }
            catch (e) {
                alert('error:' + e.Message);
            }
        }
    
    function success() {
    }
    
    function failed(sender, args) {
            alert("failed. Message:" + args.get_message());
        }
    Thanks


    Satyam MCITP, MCPD

All Replies

  • Monday, May 28, 2012 11:35 AM
     
     

    Check once the config for below tag

    <configuration>
      <system.web>
          …
         
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
      </system.serviceModel>
    </configuration>

    Further check the ULS Logs. Do any update or permission change done ?


    Regards, Dharnendra Shah, MCTS,MCPD - Sharepoint 2010 Application Development Blog: http://ds-sharepoint2010blogs.blogspot.in/ Email: shahdg2003@gmail.com

  • Monday, May 28, 2012 12:10 PM
    Moderator
     
     

    Hi

    Could you check the  window event log on the Sharepoint server and check if there are errors mentioning client.svc? This is the service that COM applications use to interact with the server object model and the content database. The exception you get  indicates a malfunctioning service.


    Kind Regards Bjoern
    Blog



  • Monday, May 28, 2012 12:28 PM
     
     

    Thanks Bjoern, After checking event log I found

    WebHost failed to process a request.
     Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/65849037
     Exception: System.ServiceModel.ServiceActivationException: The service '/_vti_bin/client.svc' cannot be activated due to an exception during compilation.  The exception message is: Server execution failed
    . ---> System.Runtime.InteropServices.COMException (0x80080005): Server execution failed

       at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
       at System.DirectoryServices.DirectoryEntry.Bind()
       at System.DirectoryServices.DirectoryEntry.get_AdsObject()
       at System.DirectoryServices.PropertyValueCollection.PopulateList()
       at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
       at System.DirectoryServices.PropertyCollection.get_Item(String propertyName)
       at Microsoft.SharePoint.Client.ClientRequestServiceBehaviorAttribute.<>c__DisplayClass1.<get_AuthInfo>b__0()
       at Microsoft.Office.Server.Security.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
       at Microsoft.SharePoint.Client.ClientRequestServiceBehaviorAttribute.get_AuthInfo()
       at Microsoft.SharePoint.Client.ClientRequestServiceBehaviorAttribute.GetAllAuthenticationSchemes(AuthenticationSchemes& defaultOne)
       at Microsoft.SharePoint.Client.Services.EndpointCreator.AddEndpoints()
       at Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHost.OnOpening()
       at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
       --- End of inner exception stack trace ---
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
       at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
     Process Name: w3wp
     Process ID: 5820


    Satyam MCITP, MCPD

  • Tuesday, June 26, 2012 1:13 PM
     
     

    Hi Everyone,

    Even I'm facing the same error, when I'm retrieving the SharePoint choice field values using the client object model, I verified the web.config entry "<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />" and it's value is already set as true, when I restart the IIS it is working fine, not sure what is the error? please let me know if any one know the solution to fix this error, this is weird issue sometimes working fine without any issue, if we have no solution for this issue, there is no use of Client object model, which is the major feature of SharePoint 2010, I hope there should be a solution or proper approach to use the Client object model.

  • Tuesday, June 26, 2012 1:37 PM
     
     

    Hi All,

    Please find the below blog for temporary fix, not sure whether this fix causes any other issues or not, as of now I didn't see any issues, Thanks to Chad Schroeder

    http://chadschroeder.blogspot.in/2011/01/unexpected-response-systemservicemodels.html

    Solution is very simple, navigate to 14\ISAPI\web.config on each WFE and add below entry.

    <system.serviceModel>

        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

    </system.serviceModel>

    I will update if I see any other issues with this solution.


  • Wednesday, December 12, 2012 5:17 PM
     
     

    Issue resolved

    rather embarrassingly, what it turned out to be was a resource issue. The VM the intranet server was running on, also hosted Spiceworks. When that kicked off a scan, the resources went to 94% 

    We killed the scan and it all settled down again.. Some more resources to add tomorrow me thinks

    thanks anyway