小编G G*_* Gr的帖子

使用网络参考

因此,在我的项目中学习Web引用几天后,我现在遇到了一个奇怪的问题.

使用简单的控制台应用程序我这样做:

namespace Webservices09004961
{
    class Program
    {
        static void Main(string[] args)
        {

            {
                Convert.ConvertTemperatureSoapClient client =
                new Convert.ConvertTemperatureSoapClient();
                while (true)
                {
                    Console.Write("Enter temperature in Celsius: ");
                    double tempC = double.Parse(Console.ReadLine());
                    double tempF = client.ConvertTemp(tempC, Convert.TemperatureUnit.degreeCelsius, Convert.TemperatureUnit.degreeFahrenheit);
                    Console.WriteLine("That is " + tempF + " degrees Farenheit");
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我在与此链接相关的服务参考"转换"中添加了:http: //www.webservicex.net/ConvertTemperature.asmx?WSDL

但是我收到此错误:

无法加载合同"Convert.ConvertTemperatureSoap"的端点配置部分,因为找到了该合同的多个端点配置.请按名称指明首选端点配置部分.

这是因为您一次只能分配一个服务引用吗?我问的原因是因为我在同一项目构建中的本地服务引用仍然可以正常工作?然而这个不是吗?(它是我第一次创建时做的)

或者这是一个单独的问题?

还有什么限制SOAP?

c# asp.net wcf soap web-services

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

神经网络,遗传算法作为入侵检测系统

嗨,我需要一些帮助才能开始创建我的第一个算法; 我想创建一个NN /遗传算法用作入侵检测系统.

但我正在努力解决一些问题(之前从未写过算法.)

  1. 我想在C#中开发是否可以作为控制台应用程序?如果是这样的话,作为一个先驱,程序大致会有多大,最简单的形式.它甚至可能在c#中?
  2. 如何连接程序以从网络读取数据?如何将数据包转换为算法的可读数据.
  3. 如何让程序为snort或其他形式的防火墙编写规则,并阻止程序认为是潜在的威胁.(即它发现来自No.2的威胁然后它将规则写入阻止特定流量的snort规则页面)
  4. 如何跟踪数据.(它阻止了什么观察它得出的结论)
  5. 将它放在网络上的哪个位置?(该程序可以连接到其他算法并在同一网络上共享数据,这将是有益的)

如果有人能帮助我开始正确的方向或解释有什么其他替代品,如模糊逻辑等,为什么它被视为黑匣子?

c# algorithm neural-network genetic-algorithm

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

朴素贝叶斯行分类

如何在MATLAB中对一行单独的单元格进行分类?

目前我可以像这样分类单个coloums:

training = [1;0;-1;-2;4;0;1]; % this is the sample data.
target_class = ['posi';'zero';'negi';'negi';'posi';'zero';'posi'];
% target_class are the different target classes for the training data; here 'positive' and 'negetive' are the two classes for the given training data

% Training and Testing the classifier (between positive and negative)
test = 10*randn(25, 1); % this is for testing. I am generating random numbers.
class  = classify(test,training, target_class, 'diaglinear')  % This command classifies the test data depening on the given training data …
Run Code Online (Sandbox Code Playgroud)

statistics matlab classification machine-learning

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

用于字符串比较的DateTime.TryParseExact方法

嘿你怎么能在给定日期做一个字符串比较匹配,DateTime.TryParseExact看起来像是明智的选择,但我不知道如何在下面的方法中构建争论:

public List<Dates> DateEqualToThisDate(string dateentered)
{
    List<Dates> date = dates.Where(
        n => string.Equals(n.DateAdded, 
                           dateentered,
                           StringComparison.CurrentCultureIgnoreCase)).ToList();
        return hiredate;
 }
Run Code Online (Sandbox Code Playgroud)

c# linq

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

访问'if'语句之外的变量

如何insuranceCostif声明之外提供?

if (this.comboBox5.Text == "Third Party Fire and Theft")
{
    double insuranceCost = 1;
}
Run Code Online (Sandbox Code Playgroud)

c#

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

找不到服务端点?

在尝试从我的服务中获取时,似乎遇到了未找到服务端点的问题.

如果我尝试http:// localhost:8000/hello/help我应该看到,<string>You entered help <string>但我只得到无端点?我根本没有触及我的配置文件,我只是从一个控制台应用程序托管.

主办:

namespace Host
{
    class Program
    {
        static void Main(string[] args)
        {
            WebHttpBinding binding = new WebHttpBinding();
            WebServiceHost host =
            new WebServiceHost(typeof(Service1));
            host.AddServiceEndpoint(typeof(IService1),
            binding,
            "http://localhost:8000/hello");
            host.Open();
            Console.WriteLine("Hello world service");
            Console.WriteLine("Press <RETURN> to end service");
            Console.ReadLine();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

服务1:

namespace WcfServiceLibrary1
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
    public class Service1 …
Run Code Online (Sandbox Code Playgroud)

.net c# rest wcf

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

wireshark网络拓扑

有没有人知道一个程序可以采取wireshark(pcap)跟踪并将其转换为可视网络拓扑?

我有3个带有"ALOT"数据的pcap文件,我真的想知道我是否可以理解一些事情.

我玩过像网络矿工这样的东西,但没有任何可以给数据提供视觉提示的东西.例如在此输入图像描述

networking trace topology pcap wireshark

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

在mvc中动态添加boostrap行和列

我的foreach循环有问题:

@for(int i = 0; i < Model.Count(); i += 3)
{
    <div class="row">
        @foreach (var item in Model) 
        {
            <div class="col-md-4 portfolio-item">
                <a href="@Html.DisplayFor(modelItem => item.UrlSlug)">
                    <img class="img-responsive" src="http://placehold.it/700x400" alt="">
                </a>
                <h3>
                <a href="@Html.DisplayFor(modelItem => item.UrlSlug)">@Html.DisplayFor(modelItem => item.Title)</a>
                </h3>
                <p>@Html.DisplayFor(modelItem => item.ShortDescription)</p>
                @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                @Html.ActionLink("Details", "Details", new { id = item.Id }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.Id })
            </div>
        }
    </div>
}
Run Code Online (Sandbox Code Playgroud)

此方法显示一个大的长长的清单,但我只想要显示的三(3次)<div class="col-md-4 portfolio-item"><div class="row"> …

c# linq asp.net-mvc html5 twitter-bootstrap

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

表单提交后如何停止从部分页面重定向

有一个问题,我有一个名为Manage的局部视图,我将局部加载到:

Controller AdminPanelAdminProfile像这样查看:

                        <div id="tab-2" class="tab-pane">
                               @{Html.RenderPartial("~/Views/Account/Manage.cshtml");
                               }
                        </div>
Run Code Online (Sandbox Code Playgroud)

当我点击保存更改时,我被重定向到/Account/Manage,它应该是/AdminPanel/AdminProfile?

在此处输入图片说明

如果我尝试使用 ajax 脚本,不确定控制器是否为 json 返回正确的重定向或信息:

    public ActionResult Manage(ManageMessageId? message)
    {
        ViewBag.StatusMessage =
            message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
            : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
            : message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed."
            : "";
        ViewBag.HasLocalPassword = OAuthWebSecurity.HasLocalAccount(WebSecurity.GetUserId(User.Identity.Name));
        ViewBag.ReturnUrl = Url.Action("Manage");
        return View();
    }
public ActionResult Manage(LocalPasswordModel model)
{
    bool hasLocalAccount = OAuthWebSecurity.HasLocalAccount(WebSecurity.GetUserId(User.Identity.Name)); …
Run Code Online (Sandbox Code Playgroud)

javascript c# asp.net-mvc jquery json

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

Invalidcastexception JsonConvert.DeserializeObject

我收到一个无效的强制转换异常,指出指定的强制转换无效。在这一行:

RootObject mountain = JsonConvert.DeserializeObject<RootObject>(json1);
Run Code Online (Sandbox Code Playgroud)

文档来看,这应该没问题?我可以看到控制台输出正常吗?

响应:[{“Height_ft”:2999.0,“Height_m”:914.0,“ID”:“c1”,“纬度”:57.588007,“经度”:-5.5233564,“名称”:“Beinn Dearg”,“湿度”: 0.81,“snowCover”:4.99,“温度”:63.0}]

        Spinner spinner = (Spinner)sender;
        string urlmountain = "http://removed.azurewebsites.net/api/Mountains?name=";
        JsonValue json1 = FetchMountain(urlmountain+string.Format("{0}", spinner.GetItemAtPosition(e.Position)));
        //below.................................
        RootObject mountain = JsonConvert.DeserializeObject<RootObject>(json1); //this line
        string toast = mountain.Name;
        Toast.MakeText(this, toast, ToastLength.Long).Show();

    private JsonValue FetchMountain(string urlmountain)
    {
        // Create an HTTP web request using the URL:
        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(urlmountain));
        request.ContentType = "application/json";
        request.Method = "GET";

        // Send the request to the server and wait for the response:
        using (WebResponse response = request.GetResponse()) …
Run Code Online (Sandbox Code Playgroud)

c# json json.net xamarin

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