Solved

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

Posted on 2009-06-26
8
364 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
ID: 24726105
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
ID: 24726119
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
ID: 24734860
0
 

Author Comment

by:newbieweb
ID: 24746931
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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 14

Expert Comment

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

Author Comment

by:newbieweb
ID: 24781125
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
ID: 24781193
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
ID: 24781256
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
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.

910 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

16 Experts available now in Live!

Get 1:1 Help Now