zoukankan      html  css  js  c++  java
  • 如何在发布使用WCF的silverlight

    最近遇到silverlight的发布问题,windows7下发布silverlight和容易,但是如果使用了WCF的话,会有几点问题需要注意

    1.WCF在IIS中的安装

    在IIS中使用WCF要配置的,具体如下

    在命令提示符下运行

    "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -i
    iisreset

    2.WCFconfig的设置,这一点最容易搞错

    在ServiceReferences.ClientConfig中

     <client>
                <endpoint address="http://localhost/KioskAdmin/Services/CategoryService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_CategoryService"
                    contract="CategoryServiceReference.CategoryService" name="CustomBinding_CategoryService" />
                <endpoint address="http://localhost/KioskAdmin/Services/UsersService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_UsersService"
                    contract="UsersServiceReference.UsersService" name="CustomBinding_UsersService" />
                <endpoint address="http://localhost/KioskAdmin/Services/CouponService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_CouponService"
                    contract="CouponServiceReference.CouponService" name="CustomBinding_CouponService" />
                <endpoint address="http://localhost/KioskAdmin/Services/EncryptionService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_EncryptionService"
                    contract="EncryptionServiceReference.EncryptionService" name="CustomBinding_EncryptionService" />
                <endpoint address="http://localhost/KioskAdmin/Services/FunctionService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_FunctionService"
                    contract="FunctionServiceReference.FunctionService" name="CustomBinding_FunctionService" />
                <endpoint address="http://localhost/KioskAdmin/Services/LoginService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_LoginService"
                    contract="LoginService.LoginService" name="CustomBinding_LoginService" />
                <endpoint address="http://localhost/KioskAdmin/Services/MediaService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_MediaService"
                    contract="MediaServiceReference.MediaService" name="CustomBinding_MediaService" />
                <endpoint address="http://localhost/KioskAdmin/Services/ProductService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_ProductService"
                    contract="ProductServiceReference.ProductService" name="CustomBinding_ProductService" />
                <endpoint address="http://localhost/KioskAdmin/Services/RoleService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_RoleService"
                    contract="RoleServiceReference.RoleService" name="CustomBinding_RoleService" />
                <endpoint address="http://localhost/KioskAdmin/Services/StandbyService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_StandbyService"
                    contract="StandbyServiceReference.StandbyService" name="CustomBinding_StandbyService" />
                <endpoint address="http://localhost/KioskAdmin/Services/StoreService.svc"
                    binding="customBinding" bindingConfiguration="CustomBinding_StoreService"
                    contract="StoreServiceReference.StoreService" name="CustomBinding_StoreService" />
                <endpoint address="http://localhost/KioskAdmin/Services/UploadService.svc"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_UploadService"
                    contract="UploadServiceReference.UploadService" name="BasicHttpBinding_UploadService" />
            </client>

    这里localhost要替换成你的公网IP或域名,原因很简单,silverlight是客户端的,当你在客户端输入http://localhost/时只会找到你的本地计算机,而不是服务器,因此要替换为你的服务器IP,否则就是下图

    image

    3.也容易搞错的一点,就是跨域文件clientaccesspolicy.xml的位置

    一定要在IIS的根目录,一般为C:\inetpub\wwwroot

    clientaccesspolicy.xml下载

  • 相关阅读:
    关于Entity Framework中的Attached报错的完美解决方案
    关于C# Winform DataGridView 设置DefaultCellStyle无效的原因与解决方案
    实现winform DataGridView控件判断滚动条是否滚动到当前已加载的数据行底部
    关于Entity Framework自动关联查询与自动关联更新导航属性对应的实体注意事项说明
    阅读《LEARNING HARD C#学习笔记》知识点总结与摘要系列文章索引
    阅读《LEARNING HARD C#学习笔记》知识点总结与摘要五
    C# Winform 通过FlowLayoutPanel及自定义的编辑控件,实现快速构建C/S版的编辑表单页面
    NPOI导入导出EXCEL通用类,供参考,可直接使用在WinForm项目中
    阅读《LEARNING HARD C#学习笔记》知识点总结与摘要四
    C#实现通用数据过滤窗体
  • 原文地址:https://www.cnblogs.com/conan77/p/1637295.html
Copyright © 2011-2022 走看看