简体   繁体   中英

Webservice doesn't fire on host computer when using IP address

I cannot quite know what the problem is but I'll try to explain the current behavior:

I have a silverlight application that interacts with the CRM. On a button click some data is loaded from the CRM. This application is published locally on my IIS.

From the Host computer : - I used the URL containing "localhost" to access my application, the button fired the webservice and the data was loaded. - I used the URL containing the "IP address", but then the button did nothing at all, also no script errors appearing. (My question here)

From another computer on the network : - I used the URL containing the "IP address" and it worked fine

Can somebody point me on why I cannot use the IP address locally to access my application ?

Edit:

The code behind the button click:

   private void Contacts_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            QueryExpression query = new QueryExpression();
             query.EntityName = "contact";
            query.ColumnSet = new ColumnSet() { AllColumns = true, Columns = new System.Collections.ObjectModel.ObservableCollection<string>(new String[]{ "" })};

            query.PageInfo = new PagingInfo { Count = MaxRecordsToReturn, PageNumber = 1, PagingCookie = null };
            OrderExpression oe = new OrderExpression();
            oe.AttributeName = "fullname";
            oe.OrderType = OrderType.Ascending;
            query.Orders = new System.Collections.ObjectModel.ObservableCollection<OrderExpression>(new OrderExpression[] { oe }) ;
            OrganizationRequest request = new OrganizationRequest() { RequestName = "RetrieveMultiple" };
            request["Query"] = query;

            IOrganizationService service = SilverlightUtility.GetSoapService();

            service.BeginExecute(request, new AsyncCallback(Contact_ClickCallback), service);
        }
        catch (Exception ex)
        {
            //this.ReportError(ex);
        }
    }

    private void Contact_ClickCallback(IAsyncResult result)
    {
        try
        {
            OrganizationResponse response = ((IOrganizationService)result.AsyncState).EndExecute(result);
            EntityCollection results = (EntityCollection)response["EntityCollection"];
            System.Collections.ObjectModel.ObservableCollection<StudentClass> resultsarray=getTwoDimensionalArray(results);

            Dispatcher.BeginInvoke(delegate { EntityDataGrid.ItemsSource = resultsarray; });


        }
        catch (Exception ex)
        {
            //this.ReportError(ex);
        }
    }

The function: getTwoDimensionalArray, simply takes the returned entity collection and creates an instance of class "Contacts" to hold the returned values.

It sounds like a loopback check problem. See this KB article for details: http://support.microsoft.com/kb/896861

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM