首页 \ 问答 \ 无法连接到Microsoft远程调试监视器。(Unable to connect to the Microsoft Remote Debugging Monitor. A security package specific error occurred)

无法连接到Microsoft远程调试监视器。(Unable to connect to the Microsoft Remote Debugging Monitor. A security package specific error occurred)

尝试附加到在我们域中的另一台PC上运行的远程调试监视器时,出现以下错误:

“无法连接到名为''的Microsoft Visual Studio远程调试监视器。出现安全软件包特定错误。”

另外,如果您在远程机器上查看,则可以在远程调试器窗口中看到自己已“连接”。


I'm getting the following error when trying to attach to a remote debugging monitor running on another PC on our domain:

"Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named ''. A security package specific error occurred."

In addition, if you look on the remote machine you can see yourself as "connected" in the remote debugger window.


原文:https://stackoverflow.com/questions/4786016
更新时间:2022-11-19 17:11

最满意答案

首先,最好提取对User模型的find(:all, ...)调用。 例如,将其search

class User < ActiveRecord::Base
  scope :search_by_email, lambda { |email|
    joins(:roles).where(["name IN (?) and email like '#{email}%'",["content team","ops team"]])
  }
end

然后在控制器中使用它:

def admin_search
   @admins = User.search_by_email(params[:email]).paginate(:page => params[:page], :per_page => 10)
end

现在,您可以单独测试search_by_email方法 - 检查,它只返回“内容团队”和“操作团队”的结果,正确使用空电子邮件字符串等。

我不认为你必须测试paginate方法,因为它应该已经在kaminari,will_paginate或你使用的任何东西测试过。 但是如果你想确定它被调用,那么你可以在控制器规范中使用模拟期望( should_receive )。

编辑:规格如何看起来像

describe User do
  describe ".search_by_email" do
    let(:content_team) { Role.create! name: "content team" }
    let(:ops_team)     { Role.create! name: "ops team"     }
    let(:another_team) { Role.create! name: "another team" }

    it "should search in content team" do
      content_team_user = User.create! email: "joe.black@example.com", roles: [content_team]
      User.search_by_email("black").should == [content_team_user]
    end

    it "should search in ops team" do
      ops_team_user = User.create! email: "joe.black@example.com", roles: [ops_team]
      User.search_by_email("black").should == [ops_team_user]
    end

    it "should not search in other teams" do
      other_team_user = User.create! email: "joe.black@example.com", roles: [another_team]
      User.search_by_email("black").should == []
    end

    it "should not search by empty string" do
      content_team_user = User.create! email: "joe.black@example.com", roles: [content_team_user]
      User.search_by_email("").should == []
      User.search_by_email(nil).should == []
    end

    # more specs for search...
  end
end


describe UsersController do
  describe "admin search" do
    let(:admin_user) { double(:admin_user).as_null_object }
    let(:search_string) { 'joe' }

    it "should search for admin users" do
      User.should_receive(:search_by_email).with(search_string).and_return([admin_user])
      get :admin_search, email: search_string
      assigns(:admins).should == [admin_user]
    end
  end
end

First of all, it's better to extract find(:all, ...) call to User model. Call it search, for instance.

class User < ActiveRecord::Base
  scope :search_by_email, lambda { |email|
    joins(:roles).where(["name IN (?) and email like '#{email}%'",["content team","ops team"]])
  }
end

Use it in the controller then:

def admin_search
   @admins = User.search_by_email(params[:email]).paginate(:page => params[:page], :per_page => 10)
end

Now, you can test the search_by_email method in isolation - check, that it returns result for "content team" and "ops team" only, correctly works with empty email string and so on.

I don't think you have to test paginate method, as it should be already tested in kaminari, will_paginate or whatever you use. But if you want to be sure, that it is being called, than you can use mock expectations (should_receive) in the controller specs.

EDIT: How the specs could look like

describe User do
  describe ".search_by_email" do
    let(:content_team) { Role.create! name: "content team" }
    let(:ops_team)     { Role.create! name: "ops team"     }
    let(:another_team) { Role.create! name: "another team" }

    it "should search in content team" do
      content_team_user = User.create! email: "joe.black@example.com", roles: [content_team]
      User.search_by_email("black").should == [content_team_user]
    end

    it "should search in ops team" do
      ops_team_user = User.create! email: "joe.black@example.com", roles: [ops_team]
      User.search_by_email("black").should == [ops_team_user]
    end

    it "should not search in other teams" do
      other_team_user = User.create! email: "joe.black@example.com", roles: [another_team]
      User.search_by_email("black").should == []
    end

    it "should not search by empty string" do
      content_team_user = User.create! email: "joe.black@example.com", roles: [content_team_user]
      User.search_by_email("").should == []
      User.search_by_email(nil).should == []
    end

    # more specs for search...
  end
end


describe UsersController do
  describe "admin search" do
    let(:admin_user) { double(:admin_user).as_null_object }
    let(:search_string) { 'joe' }

    it "should search for admin users" do
      User.should_receive(:search_by_email).with(search_string).and_return([admin_user])
      get :admin_search, email: search_string
      assigns(:admins).should == [admin_user]
    end
  end
end

相关问答

更多
  • 首先,最好提取对User模型的find(:all, ...)调用。 例如,将其search 。 class User < ActiveRecord::Base scope :search_by_email, lambda { |email| joins(:roles).where(["name IN (?) and email like '#{email}%'",["content team","ops team"]]) } end 然后在控制器中使用它: def admin_search ...
  • 我不认为uniq! 是您希望在这种情况下使用的方法,请参阅: 如果没有更改,则返回nil(即没有找到重复项)。 https://ruby-doc.org/core-2.2.0/Array.html#method-i-uniq-21 所以它是这样工作的: 2.3.1 :008 > a = [1,2,3,3,nil].uniq! => [1, 2, 3, nil] 2.3.1 :009 > a = [1,2,3,nil].uniq! => nil 2.3.1 :010 > 另一方面, uniq作用如下: ...
  • 将您的控制器规范更改为请求规范,这是从RSpec 3.5开始,在Rails中测试控制器的首选方法 由于在原始配置中没有将#bar动作绑定到URL,因此您会收到该错误。 所以当规范执行#bar ,没有该动作的URL。 控制器规范不像您想象的那样工作; 没有任何事情要求你指定的路径。 相反,它会执行您在#bar操作中编写的代码,并从响应中拉取网址。 为了减轻这一点,你可以改变你的规格type:来:request而不是:controller 。 那你可以这样做: RSpec.describe Applicatio ...
  • 默认情况下,rspec配置为不呈现视图( 请参见此处 )可以在spec / support / spec_helper.rb(或spec / support / rails_helper.rb)中进行更改,如下所示: RSpec.configure do |config| config.render_views = true end 或者可以在需要的spec文件中添加块: require 'rails_helper' RSpec.configure do |config| config. ...
  • 您对该请求的呼叫应该在任何should_receive 。 这是一件紧张的事情。 所以它有这样的读法,“当发生这种情况时,类别应该收到一些东西”。 “发生这种情况”是指请求。 it "should find the category by url" do Category.should_receive(:find).with... get "show", { your params, if you're sending some in } end 此外,您至少要通过调用控制器方法本身的方式来执行 ...
  • 您可以尝试使用should_receive并将其放入块之前,因为这是一种更好的做法: describe AttachmentsController do describe "POST create" do let(:attachment) { mock_attachment(:save => save_result) } subject { post :create, :attachment => params } before do Attachment.sho ...
  • 我一直在敲我的头好几个小时,但我只想出来了。 我需要在用户工厂中确认用户 。 我想因为我在设计中启用了confirmable模块,并且用户未被确认,所以它默默地不允许我进行身份验证... ...如果rspec / rails / devise产生某种错误指向我这里的问题,肯定会很好。 为了完整起见,我在撰写本文时添加了用于在FactoryGirl版本中确认用户的代码: FactoryGirl.define do factory :confirmed_user, :parent => :user do ...
  • 我实际上没有看到测试中的重载(你应该在那里做一个)。 200会建议eihter(a)有一个用户认证步骤,你在测试中没有处理过,或者(b)有一个验证问题。 您可以在upate方法中使用gem'prie'和binding.pry来测试其中一个/两个。 如果pry没有在更新中执行,那么更新没有执行(可能是用户身份验证问题),如果确实执行了,你可以查看@project.errors.full_messages以查看问题所在。 I don't actually see a reload in the test (yo ...
  • 您的错误来自您的视图,但默认情况下,RSpec中的控制器测试不会呈现视图。 您可以使用rspec-rails的render_views方法强制您的控制器规范呈现视图。 Your error is coming from your view, but by default, controller tests in RSpec won't render views. You can use rspec-rails's render_views method to force your controller sp ...
  • 这是一个请求规范(基本上是一个rails集成测试),旨在跨越多个请求,可能跨越控制器。 controller变量由集成测试提供的请求方法设置( get , put , post等) 如果您使用capybara DSL(访问,点击等),那么集成测试方法永远不会被调用,因此controller将是零。 使用水豚时,您无法访问单个控制器实例,因此您无法测试诸如signed_in? 返回 - 您必须测试更高级别的行为(例如页面上的内容)。 This is a request spec (which is basic ...

相关文章

更多

最新问答

更多
  • 您如何使用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)