?
Solved

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

Posted on 2009-06-26
8
Medium Priority
?
369 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 total points
ID: 24734860
0
Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

 

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
 
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
In the wake of AWS' S3 outage, we want to discuss the importance of storage and data diversification in the event of a hack, crash, or system disruption. We spoke with Experts Exchange’s COO Gene Richardson for a deeper understanding.
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.

719 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