Datakent Ana Sayfa
Anasayfa Anasayfa > Diğer bölümler > C# & ASP.NET
  Aktif Konular Aktif Konular RSS: SilverLight dan Webservis'e erişim
  Yardım Yardım  Hızlı Ara   Kayıt Ol Kayıt Ol  Giriş Giriş

SilverLight dan Webservis'e erişim

 Yanıt Yaz Yanıt Yaz
Yazar
Mesaj
murat turan Açılır Menü Göster
Admin Group
Admin Group
Simge
Datakent

Kayıt Tarihi: 01.Ekim.2003
Bulundugu Yer: Turkey
Online: Sitede Değil
Gönderilenler: 1798
  Alıntı murat turan Alıntı  Yanıt YazCevapla Mesajın Direkt Linki Konu: SilverLight dan Webservis'e erişim
    Gönderim Zamanı: 29.Nisan.2012 Saat 18:06
SilverLight ve WPF 'den webservis'e erişirken ilk aşamada aşağıdaki hata benzeri hata alabilirsiniz.
 
An error occurred while trying to make a request to URI 'http://192.168.2.2/xFile/WebService.asmx'. 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. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
Bu hatanın çözümü:
ISS'in wwwroot  klasörüne aşağıdaki isimlerdeki dosyaları oluşturun. (varsayılan yol: C:\inetpub\wwwroot )
 
1. dosya adı: clientaccesspolicy.xm
 
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="SOAPAction">
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>
 
2. dosya adı: crossdomain.xml
 
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/>
</cross-domain-policy>
 
 
 
akabinde web servis'e erişebilirsiniz.
Erişim örneği:
 
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            ServiceReference1.WebServiceSoapClient xx = new ServiceReference1.WebServiceSoapClient();
            xx.testxCompleted+=new EventHandler<ServiceReference1.testxCompletedEventArgs>(xx_testxCompleted);
            xx.testxAsync(textBox1.Text);
        }
 
        void xx_testxCompleted(object sender, ServiceReference1.testxCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                textBox1.Text = e.Result;
             }
            else
            {
                label1.Content = e.Error.ToString();
            }
        }
 


Düzenleyen murat turan - 29.Nisan.2012 Saat 18:07
Yukarı Dön
 Yanıt Yaz Yanıt Yaz

Forum Atla Forum İzinleri Açılır Menü Göster



Bu Sayfa 0,164 Saniyede Yüklendi. [power by : WebWiz]