小编ini*_*iki的帖子

可以为多个WCF服务合同添加一个服务引用

我在一个WCF库中定义了多个服务契约,这些托管在Windows服务下托管.这些服务在Windows服务配置文件中公开如下:

<services>
  <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
    name="ReportingComponentLibrary.TemplateService">
    <endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateService" bindingConfiguration="wsHttp" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateService/" />
      </baseAddresses>
    </host>
  </service>
  <service behaviorConfiguration="ReportingComponentLibrary.TemplateServiceBehavior"
    name="ReportingComponentLibrary.TemplateReportService">
    <endpoint address="" binding="wsHttpBinding" contract="ReportingComponentLibrary.ITemplateReportService" bindingConfiguration="wsHttp" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" ></endpoint>
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8080/ReportingComponentLibrary/TemplateReportService/" />
      </baseAddresses>
    </host>
  </service>
</services>
Run Code Online (Sandbox Code Playgroud)

现在,当我在客户端应用程序中添加服务引用时,

是否可以为上述两个服务添加一个服务引用或

我需要为每个服务/服务合同分开参考.

更新:

以下是我的申请详情:

我有三个不同的项目:

  1. WCF服务库
  2. 用于托管WCF服务的Windows服务
  3. 客户端 - 测试控制台应用程序

现在,WCF服务库中的App.Config如下:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>     

  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="wsHttp" maxReceivedMessageSize="50000000" maxBufferPoolSize="50000000" messageEncoding="Mtom">
          <readerQuotas maxDepth="500" maxStringContentLength="500000000" maxArrayLength="500000000"
          maxBytesPerRead="500000000" maxNameTableCharCount="500000000" />
        </binding> …
Run Code Online (Sandbox Code Playgroud)

wcf wcf-client

1
推荐指数
1
解决办法
3258
查看次数

用空字符串C#替换双引号

我有一个看起来像的字符串,codes=”A,B,C”我从word文档解析后得到它.

在运行时我只想用空字符串替换这些双引号.

我试过做类似的事情str.Replace("\"", "").但以上双引号没有被取代:(

作为codes=”A,B,C”似乎有一些不同的期待双引号,不知道这是造成问题的原因.

请指导我如何从上面的字符串替换这些双引号.

谢谢!

c# string

1
推荐指数
1
解决办法
2万
查看次数

ASP.Net - 在用户控制服务器端方法中调用javascript

我有一个带有公共方法的用户控件:

    public void ShowDetails(Guid requestGuid)
    {            
        Label1.Text = reportGuid.ToString(); //only for testing            

        ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "ShowEmailPreview", "alert('hi');", true);
        //ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowEmailPreview", "alert('hi');", true); //doesn't work
        //Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowEmailPreview", "alert('hi');", true); //doesn't work
    }
Run Code Online (Sandbox Code Playgroud)

当这个用户控件的托管页面调用ShowDetails()时,我需要调用一些javascript.

我尝试使用ScriptManager.RegisterStartupScript和Page.ClientScript.RegisterStartupScript但它不起作用...但是,如果我在我的控件上添加UpdatePanel并为UpdatePanel添加脚本,如上所示,它运行良好.

我不想为了调用javascript而将UpdatePanel添加到我的控件中.

我错过了什么吗?

谢谢!

javascript user-controls

1
推荐指数
1
解决办法
4238
查看次数

检查WCF服务使用的InstanceContextMode

有没有办法检查我的WCF服务使用什么InstanceContextMode?

我可以在svclog文件中找到/写入这个值吗?

谢谢!

wcf

1
推荐指数
1
解决办法
1299
查看次数

在一个Windows服务下托管的多个服务

我有两个服务,名为TemplateService,TemplateReportService(都在一个WCF服务库中定义)将公开给客户端应用程序.

是否可以在一个Windows服务下托管这两个服务?

谢谢!

service wcf host

0
推荐指数
1
解决办法
584
查看次数

包含在<*>,C#中的字符串的正则表达式

我试图通过使用以下正则表达式将所有字符串包含在<*>中:

Regex regex = new Regex(@"\<(?<name>\S+)\>", RegexOptions.IgnoreCase);
string name = e.Match.Groups["name"].Value;
Run Code Online (Sandbox Code Playgroud)

但在某些情况下,我有这样的文字:

<Vendors><Vtitle/>  <VSurname/></Vendors> 
Run Code Online (Sandbox Code Playgroud)

它返回两个字符串而不是四个字符串,即高于Regex输出

<Vendors><Vtitle/> //as one string and 
<VSurname/></Vendors> //as second string
Run Code Online (Sandbox Code Playgroud)

我在哪里期待四个字符串:

<Vendors>
<Vtitle/>
<VSurname/>
</Vendors> 
Run Code Online (Sandbox Code Playgroud)

你能指导我对我的正则表达式做出什么改变吗?

我尝试添加'\ b'来指定单词边界

new Regex(@"\b\<(?<name>\S+)\>\b", RegexOptions.IgnoreCase);
Run Code Online (Sandbox Code Playgroud)

,但这没有帮助.

c# regex

0
推荐指数
2
解决办法
7723
查看次数

NHibernate in Action书

我正在寻找一本关于NHibernate的好书,并整理出"NHibernate in Action"应该对我有好处.

我目前正在开发一个使用Fluent NHibernate的项目,但仍想深入了解它是如何工作的基础知识.
想知道是否有更新版本的NHibernate在动作书中,而不是解释版本1.2.

有任何想法吗?

nhibernate

0
推荐指数
1
解决办法
812
查看次数

Powershell,Powershell SnapIn,AppCmd.exe

我刚刚开始阅读Powershell的一些教程 - 因为我想编写脚本来创建网站/虚拟目录/ appPool
但是我对这些术语感到困惑 -

  • 电源外壳
  • Powershell SnapIn
  • Appcmd.exe的

它们似乎都可以用于IIS 7.0管理任务.
请分享一下这三者如何相互区别的一些知识?

非常感谢!

powershell

0
推荐指数
1
解决办法
1471
查看次数

C#Lambda表达式

我正在尝试将值从IList集合(此处的实体)复制到stringbuilder as

Entites.Select(n => objStringBuilder.AppendLine(n.Note));
Run Code Online (Sandbox Code Playgroud)

任何人都可以指导我在这里做错了什么?

谢谢!

c# lambda

-1
推荐指数
1
解决办法
202
查看次数