小编Ham*_*ari的帖子

没有端点在net.pipe上侦听

我收到以下错误:

在net.pipe:// localhost/ServiceModelSamples/service上没有可以接受该消息的端点.这通常是由错误的地址或SOAP操作引起的.有关更多详细信息,请参阅InnerException(如果存在).

我在另一个WCF调用中调用Windows服务中的WCF自托管服务,如下所示.

                   _host = new ServiceHost(typeof(CalculatorService),
            new Uri[] { new Uri("net.pipe://localhost/PINSenderService") });

        _host.AddServiceEndpoint(typeof(ICalculator),
                new NetNamedPipeBinding(),
                "");

        _host.Open();

        ChannelFactory<ICalculator> factory = new ChannelFactory<ICalculator>(
            new NetNamedPipeBinding(NetNamedPipeSecurityMode.None),
            new EndpointAddress("net.pipe://localhost/PINSenderService"));
        ICalculator proxy = factory.CreateChannel();
        proxy.SendPin(pin);
        ((IClientChannel)proxy).Close();
        factory.Close();
Run Code Online (Sandbox Code Playgroud)

自托管WCF服务

 namespace PINSender
 {

    // Define a service contract.    

    public interface ICalculator
    {
        [OperationContract]
        void SendPin(string pin);
    }

    // Implement the ICalculator service contract in a service class.
    public class CalculatorService : ICalculator
    {
        // Implement the ICalculator methods.
        public void  SendPin(string pin)
        {
        } …
Run Code Online (Sandbox Code Playgroud)

c# wcf windows-services named-pipes

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

无法侦听管道名称,因为另一个管道端点已经在侦听该名称

我收到以下错误:

无法侦听管道名称“net.pipe://localhost/ServiceModelSamples/service/”,因为另一个管道端点已在侦听该名称

我正在从另一个 WCF 调用中调用 Windows 服务内的 WCF 自托管服务,如下所示。

$

ServiceHost _host;
var guidid = Guid.NewGuid().ToString() ;

_host = new ServiceHost(typeof(CalculatorService), new Uri[] { new Uri("net.pipe://localhost/" + guidid)});

_host.AddServiceEndpoint(typeof(ICalculator),
        new NetNamedPipeBinding(),
        "");

_host.Open();

ChannelFactory<ICalculator> factory = new ChannelFactory<ICalculator>(
    new NetNamedPipeBinding(NetNamedPipeSecurityMode.None),
    new EndpointAddress("net.pipe://localhost/" + guidid));
ICalculator proxy = factory.CreateChannel();
proxy.SendPin(pin);
((IClientChannel)proxy).Close();
factory.Close();
Run Code Online (Sandbox Code Playgroud)

自托管 WCF 服务

$

namespace PINSender
{
    // Define a service contract.    
    
    public interface ICalculator
    {
        [OperationContract]
        void SendPin(string pin);
    }

    // Implement the ICalculator service contract in a …
Run Code Online (Sandbox Code Playgroud)

c# wcf windows-services named-pipes

5
推荐指数
0
解决办法
5445
查看次数

在MVC Razor中设置ListBox的样式

这是我在我的页面中使用的ListBox的Razor语法.我该如何设置其高度和宽度?这里noCategories是来自Controller的View数据.

$ @ Html.ListBox("noCategories");

控制器:

    public ActionResult Configure(int? nopCategoryid)
    {
        model = new DataImporttModel();

        DisplaynopCommerceCategories(model, nopCategoryid);

        return View("Nop.Plugin.Data.Import.Views.DataImport.Configure", model);

    }


    private void DisplaynopCommerceCategories(DataImporttModel model, int? nopCategoryid)
    {
        var _categoryservice = new NopEngine().Resolve<ICategoryService>();

        MultiSelectList sl;

        model.nopCommerceCategories = new List<CS_ListItems>();

        foreach (var item in _categoryservice.GetAllCategories().ToList())
        {
            model.nopCommerceCategories.Add(new CS_ListItems() { Name = item.Name, ID = item.Id });
        }

        if (nopCategoryid != null)
        {

            sl = new MultiSelectList(model.nopCommerceCategories, "ID", "Name", new[] { nopCategoryid });
        }
        else
        {
            sl = new MultiSelectList(model.nopCommerceCategories, "ID", "Name");
        } …
Run Code Online (Sandbox Code Playgroud)

listbox razor asp.net-mvc-4

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

在 C# 代码中增加版本号

我正在数据库中维护文档版本。假设我想更新或增加版本号。我试过这个,但它显示我的属性是只读的?

string _versionDB = "1.0.0.0"

var version = new Version(_versionDB);
version.MajorRevision = version.Minor + 1; //error it says read only
Run Code Online (Sandbox Code Playgroud)

请任何人都可以详细说明增加版本号的正确方法吗?

c# version-control version asp.net-mvc-4

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