Solved

The project must execute in the context of the web which contains the web service

Posted on 2009-06-26
8
361 Views
Last Modified: 2014-11-12
I have a problem getting a sample ASP.NET application, with associated web service running. I make the correct program the default start-up project, but get the following error message:

Please see attached.

"The SilverLight project you are about to debug is consuming web services. Calls to the web service will fail unless the project is executed in the context of the web which contains the web service."

The web service connects to the Amazon.com website and the start-up project (AmazonStore) has a web reference to the web service (AmazonStoreWeb).

It's an easy free demo to get at:

http://www.componentone.com/SuperProducts/StudioSilverlight/

I have a feeling that the web service will not run inside the development environment, but I may be wrong.

I hope to hear from you.

Thanks,
newbieweb
AmazonStoreProblem.JPG
0
Comment
Question by:newbieweb
  • 6
  • 2
8 Comments
 

Author Comment

by:newbieweb
Comment Utility
I have attached the first few lines of the asmx file so you can tell me what I might change in order to get connected. Could it be that this still uses the tempuri.org namespace?

using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Xml.Linq;
using System.ServiceModel;
using AmazonStore_Web.com.amazon.webservices;

namespace AmazonStore_Web
{
    /// <summary>
    /// Amazon web service proxy
    /// </summary>
    [ServiceContract(Namespace = "http://tempuri.org/")]
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class AmazonStoreService : System.Web.Services.WebService
    {
        AWSECommerceService _amz = new AWSECommerceService();
        const string ACCESSKEY = "10NSHPH51BZT2KDMZ3R2"; // joetester31416@yahoo.com
0
 

Author Comment

by:newbieweb
Comment Utility
I found the attached warning associated with the reference to:

C1.SilverLight.Extended

C1 means Component One, the maker of the library.

and there's a yellow warning sign next to the name of the reference.
ReferenceWarning.JPG
0
 
LVL 14

Accepted Solution

by:
GiftsonDJohn earned 500 total points
Comment Utility
0
 

Author Comment

by:newbieweb
Comment Utility
Thanks.

This line was interesting "Hi, thnaks now i am not getting that warning, since i made my web app as a start up project."

I will try and get this running by checking the start-up project etc. But if it's a SilverLight application with a web service as part of the project, which shall I set as start-up?



Thanks,
newbieweb
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 14

Expert Comment

by:GiftsonDJohn
Comment Utility
Have you configured clientaccesspolicy.xml or crossdomainpolicy.xml file on your web service root?
0
 

Author Comment

by:newbieweb
Comment Utility
I'm not quite sure how to do this. I'll try and get this from the articles.  Let me know if you have an easy way to solve this...


Thanks,
newbieweb
0
 

Author Comment

by:newbieweb
Comment Utility
How do I edit these files?

clientaccesspolicy.xml

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>


clientaccesspolicy.xml

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="http://contoso.com"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>
0
 

Author Comment

by:newbieweb
Comment Utility
I tried adding clientaccesspolicy.xml, then crossdomain.xml:

clientaccesspolicy.xml

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-
        <domain uri="http://contoso.com"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

and then crossdomain.xml

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.amazon.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

But I still get the same error. Any ideas?

Did I do the right thing, adding the amazon domain? I do not know if they have any such policy.

This web service is running in Multiple Start-up projects along with the AmazonStore web SilverLight project which uses the web service.

Please tell me if you have any ideas...

Thanks,
newbieweb
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

When using AWS as your chosen public cloud provider you will ultimately come to a point where you need to decide and define what your storage requirements are for your data that you wish to store on AWS. There are a variety of options to choose from…
Monitoring systems evolution, cloud technology benefits and cloud cost calculators business utility.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now