客户端配置设置(Client side configuration settings)
我有一个Windows应用程序调用WCF服务来构建一个特定的URL。
从Windows应用程序调用的WCF函数接受数组形式的位置详细信息。
我遇到一个问题,当发送到WCF函数的数组大小很小时(例如10),服务返回正确的结果。
但是当数组大小增加时(例如> 200),服务将返回400 Bad请求。
我不确定数组大小或数组内容是否导致此问题。
我试图更改服务器(服务)端web.config以接受最大缓冲区大小。
<bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IServiceContract" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <system.web> <compilation debug="true" targetFramework="4.0" /> <httpRuntime executionTimeout="90" maxRequestLength="1048576" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" /> </system.web>
我仍然面临同样的问题。
在客户端(这里是windows应用程序),我们如何设置配置设置,以便客户端能够将大数据发送到服务器端?
I have a windows application which calls to a WCF service to build a specific URL.
The WCF function which gets called from windows application accepts location details in the form of an array.
I face a problem the when array size sent to WCF function is small (for eg. 10) then the service returns correct result.
But when the array size grows (for eg. >200) then service returns a 400 Bad request.
I am not sure if the array size or the array contents are causing this problem.
I have tried to change the server (service) side web.config to accept the max buffer size.
<bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IServiceContract" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <system.web> <compilation debug="true" targetFramework="4.0" /> <httpRuntime executionTimeout="90" maxRequestLength="1048576" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" /> </system.web>
Still I am facing the same issue.
In client side (here windows application) how can we set the configuration settings so that client will be able to send large data to server side?
原文:https://stackoverflow.com/questions/14745447
最满意答案
您可以通过
com.sun.star.drawing.BitmapTable
对象将图像嵌入到OOo文档中。 以下函数将获取文档(其XMultiServiceFactory
接口),指向您选择的图像文件的File
对象和必须唯一的internalName,嵌入图像并返回指向嵌入实例的URL。/** * Embeds an image into the document and gets back the new URL. * * @param factory Factory interface of the document. * @param file Image file. * @param internalName Name of the image used inside the document. * @return URL of the embedded image. */ public static String embedLocalImage(XMultiServiceFactory factory, File localFile, String internalName) { // future return value String newURL = null; // URL of the file (note that BitmapTable expects URLs starting with // "file://" rather than just "file:". Also note that getRawPath() will // return an encoded URL (with special character in the form of %xx). String imageURL = "file://" + localFile.toURI().getRawPath(); try { // get a BitmapTable object from the document (and get interface) Object bitmapTable = factory.createInstance("com.sun.star.drawing.BitmapTable"); XNameContainer bitmapContainer = (XNameContainer)UnoRuntime.queryInterface(XNameContainer.class, bitmapTable); // insert image by URL into the table bitmapContainer.insertByName(internalName, imageURL); // get interface XNameAccess bitmapAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, bitmapTable); // get the embedded URL back newURL = (String)bitmapAccess.getByName(internalName); } catch (Exception e) { throw new RuntimeException(e); } // return the new (embedded) url return newURL; }
You can embed images into an OOo document thru the
com.sun.star.drawing.BitmapTable
object. The following function will take the document (itsXMultiServiceFactory
interface), aFile
object pointing to the image file of your choice and an internalName which has to be unique, embeds the image and returns the URL pointing to the embedded instance./** * Embeds an image into the document and gets back the new URL. * * @param factory Factory interface of the document. * @param file Image file. * @param internalName Name of the image used inside the document. * @return URL of the embedded image. */ public static String embedLocalImage(XMultiServiceFactory factory, File localFile, String internalName) { // future return value String newURL = null; // URL of the file (note that BitmapTable expects URLs starting with // "file://" rather than just "file:". Also note that getRawPath() will // return an encoded URL (with special character in the form of %xx). String imageURL = "file://" + localFile.toURI().getRawPath(); try { // get a BitmapTable object from the document (and get interface) Object bitmapTable = factory.createInstance("com.sun.star.drawing.BitmapTable"); XNameContainer bitmapContainer = (XNameContainer)UnoRuntime.queryInterface(XNameContainer.class, bitmapTable); // insert image by URL into the table bitmapContainer.insertByName(internalName, imageURL); // get interface XNameAccess bitmapAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, bitmapTable); // get the embedded URL back newURL = (String)bitmapAccess.getByName(internalName); } catch (Exception e) { throw new RuntimeException(e); } // return the new (embedded) url return newURL; }
相关问答
更多-
做了一些研究并最终使用firebreath(http://www.firebreath.org/)创建了本机NPAPI插件并将其用于我自己的扩展。 我愿意在https://github.com/magomi/OOCaller上提供关于此的建议和讨论 Did some research and finally used firebreath (http://www.firebreath.org/) to create a native NPAPI plugin and to use it in my own ...
-
好的,这就是我为实现这一点所做的(使用OpenOffice UNO Api和JAVA): 加载我们要放置HTML文本的odt文档。 转到要放置HTML文本的位置。 将HTML文本保存在系统的临时文件中(也许可以不使用http URL保存,但我没有测试它)。 按照此说明将HTML插入odt并将URL传递给临时HTML文件(记住将系统路径转换为OO路径)。 OK, this is what I've done to achieve this (using OpenOffice UNO Api with JAVA ...
-
以下代码将所有正确的命名空间加载到命名空间管理器中并创建示例文档。 .NET只会输出文档中实际使用的命名空间,而不是所有命名空间。 我不确定是否有办法强制输出未使用的输出,但实际上不需要使用未使用的输出。 public static void Test() { var nt = new NameTable(); var ns = new XmlNamespaceManager(nt); var doc = new XmlDocument(nt); ns.AddNamespa ...
-
您可以通过com.sun.star.drawing.BitmapTable对象将图像嵌入到OOo文档中。 以下函数将获取文档(其XMultiServiceFactory接口),指向您选择的图像文件的File对象和必须唯一的internalName,嵌入图像并返回指向嵌入实例的URL。 /** * Embeds an image into the document and gets back the new URL. * * @param factory Factory interface of the ...
-
从OpenOffice保存为pdf(Saving to pdf from OpenOffice)[2023-12-31]
很相似:) 以下是描述用于配置生成的文档的所有功能的教程。 对于以下示例,我选择适合宽度放大,密码保护和隐藏窗口控件。 当转换时未显示OpenOffice窗口时,导出将以隐藏模式完成。 请注意,以下代码再次没有错误处理。 uses ComObj; procedure OpenOfficeExportToPDF(const ASourceFileURL: string; const ATargetFileURL: string); var StarOffice: Variant; StarDes ... -
是。 您可以使用odf库。 http://opendocumentfellowship.com/projects/odfpy 您将获得的文档将采用ODF格式,但您可以稍后使用unoconv将其转换为PPT 格式 。 Yes. You can use the odf library. http://opendocumentfellowship.com/projects/odfpy The document you'll get will be in ODF format but you can later c ...
-
openoffice ole自动化(openoffice ole automation)[2023-07-08]
我使用c#SDK而不是OLE解决了我的问题,所以这不是关于OLE问题的完全答案。 我建议使用SDK,因为您可以从官方API的预定义对象模型中受益,而在com interop中没有这样的指南。 您必须在系统上安装Openoffice SDK,然后在您的c#项目中添加对此目录中所有dll的引用: ... \ OpenOffice 4 \ sdk \ cli \ cli_basetypes.dll 这些页面包含使用c#API的实际示例: http://suite101.com/a/creating-an-open ... -
我想你的问题出现在“Name.Of.Macro”中:它必须是:Library.Module.NameOfMacro。 “langauge = Basic”当然设置语言名称,“location = application”表示应该在打开的文档中搜索宏库,而不是在全局OO库中搜索。 就参数而言,我使用: XScriptProviderSupplier xScriptPS = (XScriptProviderSupplier) UnoRuntime.queryInterface(XScriptProviderSu ...
-
实际上有一些东西可以满足而不会有很多麻烦。 这将是XForms,在这里描述: http://wiki.services.openoffice.org/wiki/Documentation/OOo3_User_Guides/Writer_Guide/Using_Forms_in_Writer 这几乎可以解释我应该做的任何事情。 Actually there is something that would suffice without a lot of hassle. This would be XForms ...
-
试试jmpress.js - 查看其主页上的展示和关于codrops的本教程 。 它们似乎完全符合您的需求。 Try out jmpress.js -- look at the showcase on its home website and this tutorial on codrops. They seem to have exactly what you need.