Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

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

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
newbieweb
Asked:
newbieweb
  • 6
  • 2
1 Solution
 
newbiewebSr. Software EngineerAuthor Commented:
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
 
newbiewebSr. Software EngineerAuthor Commented:
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
 
GiftsonDJohnCommented:
0
The Lifecycle Approach to Managing Security Policy

Managing application connectivity and security policies can be achieved more effectively when following a framework that automates repeatable processes and ensures that the right activities are performed in the right order.

 
newbiewebSr. Software EngineerAuthor Commented:
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
 
GiftsonDJohnCommented:
Have you configured clientaccesspolicy.xml or crossdomainpolicy.xml file on your web service root?
0
 
newbiewebSr. Software EngineerAuthor Commented:
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
 
newbiewebSr. Software EngineerAuthor Commented:
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
 
newbiewebSr. Software EngineerAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Simple Misconfiguration =Network Vulnerability

In this technical webinar, AlgoSec will present several examples of common misconfigurations; including a basic device change, business application connectivity changes, and data center migrations. Learn best practices to protect your business from attack.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now