views:

1435

answers:

4

Hey all,

I am working with another coder on a website that is accessing SQL Server (2008 Express) through some web services he created (involving mostly LINQ to SQL), and the UI is in Silverlight. I've been working on another part of the system, but just got his latest code, and am trying to run it on my machine, but am getting an error.

It is a CommunicationException on a line in the reference.cs file, the EndXXX method of the web service:

// This is for a Ping method we created just to trouble shoot- it behaves the same.
public string EndPing(System.IAsyncResult result) {

    object[] _args = new object[0];

    // Next line throws Communication Exception
    string _result = ((string)(base.EndInvoke("Ping", _args, result)));
    return _result;
}

The error message is:

"An error occurred while trying to make a request to URI 'http://localhost:1233/SummitService.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details."

The whole stack is on my local machine, so I shouldn't be needing to make any cross-domain calls. We looked through all the configuration code we could find (web.config, ServiceReferences.ClientConfig), to change all the references to his machine to mine. We're both pretty new to all these technologies, so we've run to the end of our knowledge.

Does this ring any bells for anyone?

A: 

The problem may be with the way that LINQ serializes the query results. If it detects relationships between tables then it sends them with the data in the service, but because Silverlight is sandboxed it can't accept any 'branched' data.

In the LINQ designer try changing the serialization mode to Unidirectional and see if that works.

Noah
Thanks for the suggestion. I tried it, but no luck. To be honest, though I gave all of the technologies used for completeness, the fact that the "Ping" web service (which just returns a string literal) has the same problem makes me think it is something simple about the services. Wish I knew what!
J Jones
A: 

So I have done some trouble shooting, and discovered that if I enter the localhost address of the aspx page that starts this whole thing, it loads fine, and I see the data from the webservice on the page. It is only when I am debugging that I get this error.

I also noticed that when I try and debug the page, it is loading the file location-- D:\projects\etc -- into the browser and not going through localhost. And it is actually loading the .html test page in the project, even though I have set the .aspx page as the start page.

So it looks to be something to do with the project settings or perhaps VS2008 settings, and not a configuration issue like I first supposed. Does anyone have any other suggestions?

J Jones
+1  A: 

Ok, so I feel a bit silly.

After beating my head against this thing off and on for several days, I discovered that I had the Silverlight project set as the startup project. I needed it to be the web project that actually had the proper authentication settings for connecting to the database-- not to mention the actual host .aspx page that I kept setting as the start page, and wondering why it wasn't being used.

As soon as I set the right project. Everything was beautiful.

J Jones
A: 

i think in you testing web project where you have add silverlight project, you have difined to create a test page every time the project built. Uncheck that option first.

Mazhar Karimi