To deploy the SILVERLIGHT+WCF Project tutorial on IIS

Source: Internet
Author: User
Tags silverlight

1. The premise of deploying the SILVERLIGHT+WCF project in IIS is to configure IIS on the published machine, with reference to http://www.jb51.net/article/29787.htm

2. When IIS is configured, open IIS to do the following:

(1) Add the following MIME type to IIS, or the project cannot be resolved

. xap Application/x-silverlight-app

. xaml Application/xaml+xml

. XBAP APPLICATION/X-MS-XBAP

(2) in the handler mappings for IIS, check for the existence of the following files

The next step is to configure the project we want to publish accordingly. When we write a Silverlight program, we need WCF to access our back-end database in most cases, and it is normal to access the database during development, but when the entire Silverlight project is published to IIS, along with WCF, You will encounter a problem where the database can be accessed properly on the server on the local IIS, but the database cannot be accessed when executing the program through the client side, and there is no error message, and the calling page is normal.

There should be a lot of people have encountered this problem, there are many on the internet to solve this problem, but most of them are from the perspective of cross-domain access to solve this problem, After attempting to add the two configuration files for Clientaccesspolicy.xmlcrossdomain.xml, and after adding the MIME configuration in IIS, there are still a lot of people who are not resolved, and finally by re-configuring the WCF configuration check, changing the way WCF binds and calls, this is the problem Completely resolved, the following to share with you the specific steps.

(1) Check your servicereferences.clientconfig file, this file is automatically generated when you add a service reference in the Silverlight program, check that the way in which WCF is bound is BasicHttpBinding, the code is as follows:

If you are customhttpbinding, you will need to modify it manually, find the Web. config file under your website, check the WCF configuration information inside, and bind it in a "basichttpbinding" manner. and the name of the contract is filled in correctly, the specific code is as follows:

After the modification is complete, re-reference the WCF service at the front end.

Finally, modify the code you call WebService:

You will also need to change address to native IP in the Servicereferences.clientconfig file before publishing.

To deploy the SILVERLIGHT+WCF Project tutorial on IIS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.