SL+WCF+LINQ 问题阶段性小结

SL+WCF+LINQ 问题阶段性小结,第1张

概述1)      In WCF Hosted Project or Web Solution , Make DataContext  (DMBL) Seriable: Set SerializationMode=Unidirectional If not , when client application try to generate the WCF services WSDL will erro @H_419_6@

1)      In WCF Hosted Project or Web Solution,Make DataContext  (DMBL) Seriable:

Set SerializationMode=UnIDirectional

If not,when clIEnt application try to generate the WCF services WSDL will error occurred,Because some object can’t be serialized .

This problem may be not occurred in local machine even the version if RELEASE .

But   it will occurred in Remote Server .

 

2)Make WCF use basichttpBinding

(If your wcf is in your web application then modify it in WebApplication web.config file

else if your wcf is a standalone application then modify it in its' web.config)

 

      3)Make the sl use the wsdl directly copIEd from the Serivice.svc Start Page

(this will make sure the sl and the wcf used the same port,and this will affect

the services.config in sl project will different)

 

4) 以下三个步骤,在传输大数据时WCF出错,显示404 错误时,检查一下几个配置是否正确。

# Bind your Web.config insIDe webservice with bindingConfiguration="LargeBuffer" where LargeBuffer is declared like this

   <bindings>

      <basichttpBinding>

        <binding name="LargeBuffer" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">

          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"

           maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxnametableCharCount="2147483647" />

        </binding>

      </basichttpBinding>

    </bindings>

 

# Then,insIDe ServiceReferences.ClIEntConfig,you should have this

<system.serviceModel>

        <bindings>

            <basichttpBinding>

                <binding name="BasichttpBinding_Buffer" maxBufferSize="2147483647"

                    maxReceivedMessageSize="2147483647">

                    <security mode="None" />

                </binding>

            </basichttpBinding>

        </bindings>

        <clIEnt>

            <endpoint address="http://3water/SteveWeb/SteveService/Service.svc"

                binding="basichttpBinding" bindingConfiguration="BasichttpBinding_Buffer"

                contract="SteveSLWeb.SteveWebService.IService" name="BasichttpBinding_Buffer" />

        </clIEnt>

    </system.serviceModel>

 

# The most important thing here is to make sure your webservice and your web is in the same port [yourweb]:#port if they are in the different ones,errors should occur. By the way,you can use IIS to host your Web,and the trick can be easily done. Moreover,if you use IIS,make sure you have put the clIEntaccesspolicy.xml onto the wwwroot with this format

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

 

5) 需要调试时,将下列CODE写入HOST WCFWEB.CONfig(直接在根节点下面)。如果是APP,则写入APP.EXECONfig. 生成的SVCLOG文件,可以用windows SDK中的Trace Log file VIEwer 看。否则很难分析。

 <system.diagnostics>

    <sources>

      <source name="System.ServiceModel"

              switchValue="information,ActivityTracing"

              propagateActivity="true">

        <Listeners>

          <add name="traceListener"

              type="System.Diagnostics.XmlWriterTraceListener"

              initializeData= "c:/log/Traces.svclog" />

        </Listeners>

      </source>

    </sources>

  </system.diagnostics>

 

6) 如果碰到404的错误,说某个System.Web.dll找不到。然后先前又改过Asp.net的页面或者项目,

原因未明。但是可以关闭重新开启项目后成功运行 . 如果不行,还可以另外删除Bin Obj目录。

 

7)如果IIS中不能解析Xap的包,那么说明还没有注册MIME类型。

Extension : .xap

MIME Type : application/x-silverlight-app

 

Just open the propertIEs dialog of virtual path,and add a MIME type

 

8)使用IsolatedStorage的时候保存自定义类型对象可以使用类似如下代码: 读取时类似

 

                IsolatedStorageSettings.ApplicationSettings[ISO_BIGP_CACHE] = Globalinfo.CurBigPhotoDict;

                IsolatedStorageSettings.ApplicationSettings.Save();

 

 

 

Summary :

 

 1)SL不支持Style,templateTriggler

 

2)Sl不支持Pack:url....的资源定位,可以直接用相对目录定位

 

3)SL不支持WCF处传出的FAulTException,无论什么EXCEPTION,它最终都会定位到一个最简单的EXCEPTION

所以得不到WCF出来的详细错误信息。这个问题MS那边要有段时间才能解决。

暂时可以用OUT的参数给WCF,然后在Methodname_Completed的方法调用结束方法中使用钢材的OUT参数。

 

4)SL的库必须是SL创建出来,不能和。NET库通用。

 

5)SL BETA2 也有很多小版本,需要注意。

装了2008SP1后,需要重新安装新版本的SL2BETEA2

 

6) The web application embedded the sl control,and sl call the wcf method to retrive the data

and the wcf use linq to sql to get data from sql server

7)All Method in SL are Async

8)If the wcf project is standalone(not hosted in the asp.net web application ) .It is Cross-Domain .

When Cross-Domain,it need two Policy Configuration file,It will be more complex .)

9)If pop silverligth need exclued in the web application warning,just set the web application as startup project.

10) the WPF and Silverlight runtime are completely different. WPF uses windows Image Component (WIC) to handle bitmap images,while Silverlight has a home grown bitmap image component. There may be some problems in WIC that some specific images can't be decoded. If you encounter any of them,try to use a tool such as windows Paint and Expression Design to recreate the image

 

11) MIME Type issue .

If the server which host IIS,is not configured MIME Type of Silverlight,when the pc which not installed the silverlight before will download a wrong version of silverlight.

Check and change the MIME type when such problem occurred.

12)关于IsolatedStoragedfile

在使用ISO的时候,有一点要注意,如果数据为Dictionary<string,List<CustomDataObject>>

则需要确定CustomDataObject以及他的List 没有被CLEAR或者disPOSE过。否则由于是引用对象的问题,将导致ISO中没有此数据.

总结

以上是内存溢出为你收集整理的SL+WCF+LINQ 问题阶段性小结全部内容,希望文章能够帮你解决SL+WCF+LINQ 问题阶段性小结所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1052422.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)