首页 \ 问答 \ 代理的生成在一个环境中工作正常但在另一个环境中不工作?(Generation of proxy works fine in one environment but not in the other?)

代理的生成在一个环境中工作正常但在另一个环境中不工作?(Generation of proxy works fine in one environment but not in the other?)

我在Windows服务(Selfhost)中托管了一个简单的Webserivce(WCF)。 服务声明如下:

<service behaviorConfiguration="MyApp.ServiceImplementation.MyAppIntegration_Behavior" name="MyApp.ServiceImplementation.MyAppIntegration">
        <endpoint binding="basicHttpBinding" bindingConfiguration="BasicMyAppIntegration" bindingNamespace="MyApp.ServiceImplementation" contract="MyApp.ServiceContracts.IMyAppIntegration"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8008/MyAppServiceutv/Integration"/>
          </baseAddresses>
        </host>
      </service>

我可以用这个URL浏览WSDL:

http://localhost:8008/MyAppServiceutv/Integration?wsdl

在Visual Studio 2012中添加服务引用时,我得到以下异常:

例外

该文件已被理解,但无法处理。

  • WSDL文档包含无法解析的链接。
  • 下载' http://localhost:8008/MyAppServiceutv/Integration?xsd=xsd0 '时http://localhost:8008/MyAppServiceutv/Integration?xsd=xsd0
  • 无法连接到远程服务器

元数据包含无法解析的引用:' http://MyComputer:8008/MyAppServiceutv/Integration?wsdl '。 内容类型application / soap + xml; 服务http://MyComputer:8008/MyAppServiceutv/Integration?wsdl不支持charset = utf-8。 客户端和服务绑定可能不匹配。 远程服务器返回错误:(415)无法处理消息,因为内容类型为'application / soap + xml; charset = utf-8'不是预期的类型'text / xml; charset = utf-8'..如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用。

转移到开发环境

将服务移动到开发计算机时,一切都很好吗? 为什么我会在一个环境中遇到上述问题? 这可能是由于强大的安全限制吗?


I have a simple Webserivce (WCF) hosted in a Windows Service(Selfhost). The declaration of the service looks like this :

<service behaviorConfiguration="MyApp.ServiceImplementation.MyAppIntegration_Behavior" name="MyApp.ServiceImplementation.MyAppIntegration">
        <endpoint binding="basicHttpBinding" bindingConfiguration="BasicMyAppIntegration" bindingNamespace="MyApp.ServiceImplementation" contract="MyApp.ServiceContracts.IMyAppIntegration"/>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8008/MyAppServiceutv/Integration"/>
          </baseAddresses>
        </host>
      </service>

I can brows the WSDL with this URL :

http://localhost:8008/MyAppServiceutv/Integration?wsdl

When adding the service reference in Visual Studio 2012 I get this exception :

Exception

The document was understood, but it could not be processed.

  • The WSDL document contains links that could not be resolved.
  • There was an error downloading 'http://localhost:8008/MyAppServiceutv/Integration?xsd=xsd0'.
  • Unable to connect to the remote server

Metadata contains a reference that cannot be resolved: 'http://MyComputer:8008/MyAppServiceutv/Integration?wsdl'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://MyComputer:8008/MyAppServiceutv/Integration?wsdl. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.. If the service is defined in the current solution, try building the solution and adding the service reference again.

Moving to Dev Environment

When moving the service to a dev computer everything works just great? Why whould I get the above problems in just one environment? Could this be due to strong security restrictions?


原文:https://stackoverflow.com/questions/16564737
更新时间:2022-07-21 09:07

最满意答案

我假设通过询问这个问题,运行时未知数会阻止您事先确定哪些项目在报告中是相同的。 否则,您可以直接引用相同的实例。

一个可以缓存“等效”实例的轻量级工厂可以帮助减少内存占用。 每个ReportComponent都需要某种参数对象来封装它们的特定数据字段,并实现equals()来定义“等效”意味着什么。

public class ReportComponentFactory {

    private final Map<String, ReportComponent> headerCache = 
        new HashMap<String, ReportComponent>();
    private final Map<GraphParameters, ReportComponent> graphCache = 
        new HashMap<GraphParameters, ReportComponent>();

    public ReportComponent buildHeader(String headerText){
        if (this.headerCache.containsKey(headerText)){
            return this.headerCache.get(headerText);
        }
        Header newHeader = new Header(headerText);
        this.headerCache.put(headerText, newHeader);
        return newHeader;
    }

    public ReportComponent buildGraph(GraphParameters parameters){
        if (this.graphCache.containsKey(parameters)){
            return this.graphCache.get(parameters);
        }
        Graph newGraph = new Graph(parameters);
        this.graphCache.put(newGraph);
        return newGraph;
    }

    ...
}

请注意,实例化参数对象将需要一些临时内存消耗,但它们应该足够容易地进行垃圾回收。


I assume that by asking this question there are runtime unknowns that prevent you from determining in advance which items will be the same across reports. Otherwise you could just reference the same instances directly.

A flyweight-style factory that caches "equivalent" instances could help reduce memory footprint. Each ReportComponent would need some sort of parameter object to encapsulate their particular data field(s) and implement equals() to define just what "equivalent" means.

public class ReportComponentFactory {

    private final Map<String, ReportComponent> headerCache = 
        new HashMap<String, ReportComponent>();
    private final Map<GraphParameters, ReportComponent> graphCache = 
        new HashMap<GraphParameters, ReportComponent>();

    public ReportComponent buildHeader(String headerText){
        if (this.headerCache.containsKey(headerText)){
            return this.headerCache.get(headerText);
        }
        Header newHeader = new Header(headerText);
        this.headerCache.put(headerText, newHeader);
        return newHeader;
    }

    public ReportComponent buildGraph(GraphParameters parameters){
        if (this.graphCache.containsKey(parameters)){
            return this.graphCache.get(parameters);
        }
        Graph newGraph = new Graph(parameters);
        this.graphCache.put(newGraph);
        return newGraph;
    }

    ...
}

Note that instantiating parameter objects will require some temporary memory consumption, but they should be garbage collected easily enough.

相关问答

更多
  • 如果您需要为主报表中的每组数据或每个详细记录重复子报表,则子报表属于组或详细信息区域。 另一件需要考虑的事情是你的子报告是否会像“独立”报告一样有意义 - 它们是否可以存在于主报告的上下文之外? 在这种情况下,以这种方式设计它们,并在最终的主报告上使用“重新导入子报告”功能来自动获取更改。 否则它并不重要,只要你能得到你想要的布局 - 在这种情况下,只做最简单的事情。 If you need your subreports to repeat for each group of data or each d ...
  • 我假设通过询问这个问题,运行时未知数会阻止您事先确定哪些项目在报告中是相同的。 否则,您可以直接引用相同的实例。 一个可以缓存“等效”实例的轻量级工厂可以帮助减少内存占用。 每个ReportComponent都需要某种参数对象来封装它们的特定数据字段,并实现equals()来定义“等效”意味着什么。 public class ReportComponentFactory { private final Map headerCache = ...
  • 我所做的只是使用Windows资源管理器或其他任何内容复制您要克隆的报告(stateLow.rdl),并将其重命名为新名称(stateHigh.rdl)。 然后在Visual Studio中,右键单击解决方案资源管理器中的Reports文件夹,选择Add -> Existing item...并添加新报表,然后使用我的更改对其进行编辑。 What I do is just make a copy of the report you want to clone (stateLow.rdl) using Win ...
  • 我看不出战略模式如何适合这里。 该模式是关于一系列算法的,例如换行策略。 你在这里没有策略,你有一个抽象的方法 TResult Populate(string data); 和它的几个实现。 我也不明白最初的问题,也许你想排队几个序列化操作? 在那种情况下,命令模式是你的朋友。 I don't see how the Strategy pattern would fit here. The pattern is about a family of algorithms, e.g. line breaking ...
  • 创建仪表板列提示时,可以将“选择列表值”下拉列表从“所有列值”下拉到SQL结果。 然后,只需运行您的报告运行的逻辑SQL(从“高级”选项卡中获取此SQL),然后将其插入此处,从而消除SQL中的任何额外内容。 如果这些ID1,ID2值不是动态且不更改,则可以使用“特定列值”选项手动选择。 虽然硬编码了这些选择,但可能不适合您。 When you create a dashboard column prompt, you can change the "Choice List Values" drop down ...
  • 该函数将返回NULL。 你错过了$string = curl_exec($ch); The function will return NULL. You are missing the $string = curl_exec($ch);
  • 模板模式不是一种模式。 它简单地描述了我们都知道的多态性的基本原理。 另一方面,策略模式定义了“功能”/“策略”的通用接口,可以在运行时换出。 这是Java中的策略模式的一个例子(对不起,不熟悉Ruby): 免责声明:不是我的代码,很好的例子。 public interface Strategy { public int doOperation(int num1, int num2); } public class OperationAdd implements Strategy{ @Over ...
  • 测试和跟踪这一点的好方法是在查询中使用的其中一个表中添加一个名为“flgReported”的“是/否”字段,然后在运行报表后,您可以将所有行更新为true。 之后添加的任何新行都将为false,您可以将其添加到您的select查询中以仅报告False行,这也可以让您测试在执行前面单击按钮时是否有任何数据要返回并运行报告。 更新:如果您突出显示有问题的宏,然后转到“工具>宏>将宏转换为Visual Basic”,然后单击“转换”它将为您生成VB代码。 然后可以从您的按钮而不是宏调用它,在主程序之前,您可以插入 ...
  • 问题出在构造函数定义MessageHandling 。 您需要删除new关键字,因为它在这里没有意义。 而不是这个代码: var MessageHandling = new function(strategy) { this.strategy = strategy; }; 用这个: var MessageHandling = function(strategy) { this.strategy = strategy; }; new 运算符用于从构造函数创建对象实例。 您不需要将它用于构造 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)