小编Dom*_*icz的帖子

Autofac.Core.DependencyResolutionException

Autofac新手在这里想要更好地理解以下异常,任何帮助/指针将非常感谢!

Unhandled Exception: 
    Autofac.Core.DependencyResolutionException: 
        None of the constructors found with 'Public binding flags' on type 'Test.Authorization.LoginService' can be invoked with the available services and parameters: 
         Cannot resolve parameter 'System.Func`1[System.IO.Stream] readStream' of constructor 'Void .ctor(System.Func`1[System.IO.Stream], System.Func`1[System.IO.Stream])'.
    at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in \autofac\src\Source\Autofac\Core\Activators\Reflection\ReflectionActivator.cs:line 117    
    at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in \autofac\src\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 79
    at Autofac.Core.Resolving.InstanceLookup.Execute() in \autofac\src\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 62
    at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in \autofac\src\Source\Autofac\Core\Resolving\ResolveOperation.cs:line 124
    at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) in \autofac\src\Source\Autofac\Core\Resolving\InstanceLookup.cs:line 115  
    at Autofac.Features.Collections.CollectionRegistrationSource.c__DisplayClass4.c__DisplayClass6.b__1(IComponentRegistration cr) in \autofac\src\Source\Autofac\Features\Collections\CollectionRegistrationSource.cs:line 80    at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() …

dependency-injection autofac

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

您的代码在混淆时有多安全?

使用RedGate的Reflector,您可以轻松获得应用程序的完整源代码.但是为了减少发现算法的可能性,有混淆器可以降低这种可能性.

我的问题是:

  • 混淆器的效果如何?
  • 在隐藏算法方面更安全的是:没有.NET库的C++或模糊的.NET程序.
  • 有没有其他方法可以使.NET源代码更安全?

.net c++ obfuscation

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

Visual Studio 2012 SSDT - 如何创建/管理表格?

我正在尝试Visual Studio 2012,到目前为止它很好,但我创建了数据库项目,将数据库*.mdf文件添加到我的App_Data并尝试创建关系的简单数据库,我不知道下一步该做什么.我甚至无法命名我的数据库.

http://msdn.microsoft.com/en-us/library/hh272680(v=vs.103).aspx - AFAIK这篇文章展示了如何添加关系,但我找不到任何Foreign Keys节点.而且,为什么我不能编辑名字?VS2010数据库管理非常简单直观,现在我不明白如何使用它.

例如,我的问题和我的简单表格的更直观的表示. 在此输入图像描述

visual-studio-2012 sql-server-data-tools

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

没有主键的事务复制(唯一索引)

我刚刚遇到一些令人不安的事情,我试图从一个设计不受我们控制的数据库中实现事务复制.这种复制是为了执行报告而不会对系统造成太大的负担.在尝试复制时,只有一些表发生了.

由于调查表没有主键,因此没有选择复制调查表,我认为如果我使用ODBC和ms访问而不是在管理工作室中,它甚至不会显示为主键.查询也不是非常慢.

我尝试插入一个重复的记录,它没有说出一个唯一的索引(不是主键).似乎是使用唯一索引实现的表与主键相对.为什么我不知道我会尖叫.

无论如何都要执行事务复制或替代方案,它需要是实时的(最后一两分钟).主db服务器目前是sql 2000 sp3a和报告服务器2005.

我目前唯一想到的尝试就是将复制设置为另一种类型的数据库.我相信复制说oracle是可能的,这会强制使用像我假设访问正在使用因此显示主键的ODBC驱动程序.我不知道这是否准确无误.

sql-server primary-key transactional-replication

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

无法复制文件,即使在C#中授予了FileIOPermission

FileIOPermission在.NET 3.5中尝试使用Windows 7.我一直是Windows XP用户,并且因为我是管理员而被授予此权限

我编写了以下代码,测试是否可以写入C:\ Program Files\Outlook ......

static void Main(string[] args)
{
    Console.WriteLine("Am I an administrator? " + new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);

    //  Try and open a file in C:\Program Files\Microsoft Office\Office14\BCSLaunch.dll
    string path = @"C:\Program Files\Microsoft Office\Office14\BCSLaunch.dll";

    try
    {
        FileIOPermission ioPerm = new FileIOPermission(FileIOPermissionAccess.Read, path);
        ioPerm.Demand();

        string backupPath = Path.ChangeExtension(path, ".bak");
        FileIOPermission writeAccess = new FileIOPermission(FileIOPermissionAccess.AllAccess, backupPath);
        writeAccess.Demand();

        Console.WriteLine("Read access is permitted: {0} => {1}",path,SecurityManager.IsGranted(ioPerm));
        Console.WriteLine("Write backup file is permitted: {0} => {1}", backupPath, SecurityManager.IsGranted(writeAccess));

        File.Copy(path, backupPath);

        Console.WriteLine("File …
Run Code Online (Sandbox Code Playgroud)

.net c# security file-permissions windows-7

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

为多个控件分配可见性的最佳方法是什么

好吧所以我正在尝试清理我的代码,因为它是一个混乱,我有25个richtext框,我想将他们的.Visible变量放入一个数组并有一个for语句通过并使每个错误,以便文本框没有显示我尝试过没有工作,我无法弄明白我的是什么.

bool[] box =  new bool[25];

box[0] = richTextBox1.Visible;
box[1] = richTextBox2.Visible;
box[2] = richTextBox3.Visible;
box[3] = richTextBox4.Visible;
box[4] = richTextBox5.Visible;
box[5] = richTextBox6.Visible;
box[6] = richTextBox7.Visible;
box[7] = richTextBox8.Visible;
box[5] = richTextBox6.Visible;
box[6] = richTextBox7.Visible;
box[7] = richTextBox8.Visible;
box[8] = richTextBox9.Visible;
box[9] = richTextBox10.Visible;
box[10] = richTextBox11.Visible;
box[11] = richTextBox12.Visible;
box[12] = richTextBox13.Visible;
box[13] = richTextBox14.Visible;
box[14] = richTextBox15.Visible;
box[15] = richTextBox16.Visible;
box[16] = richTextBox17.Visible;
box[17] = richTextBox18.Visible;
box[18] = richTextBox19.Visible;
box[19] = richTextBox20.Visible;
box[20] = richTextBox21.Visible;
box[21] = …
Run Code Online (Sandbox Code Playgroud)

c# arrays boolean

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

为什么IIS首次访问速度慢,但之后更快?

构建我的asp.net解决方案,然后在浏览器中第一次运行它,加载所需的时间增加.然后运行它,时间减少,直到下一次构建.

有人可以解释为什么会这样吗?

asp.net iis build

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

使用ASP.NET LoginView动态显示链接

我在使用LoginView时遇到了问题.有人可以告诉我是否可以在LoginView(以及如何)中执行此操作,或者是否需要使用代码隐藏.

我有两个角色 - 管理员和用户.我想根据角色动态显示链接.我会在if语句中写出我想要的东西,因为它更容易解释:

if (role = Administrator) //Display only if administrator.
   Show Hyperlink 1
   Show Hyperlink 2
else
   if (role = User) //Display only if user.
      Show Hyperlink 3
      Show Hyperlink 4
   endif
   //Display these if a user or if non-authenticated user...
   Show Hyperlink 5
   Show Hyperlink 6
   Show Hyperlink 7 
endif
Run Code Online (Sandbox Code Playgroud)

asp.net loginview

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

如何在c#中配置App.config文件

我正在使用Visual Studio 2005,并使用"App.config"文件创建了一个应用程序.当我尝试编辑并向该App.config文件添加新值时,它显示错误请帮助我..

我的app.config文件包含:

<?xml version="1.0" encoding="utf-8" ?>
 <configuration>
  <appSettings>
   <add key="keyvalue" value="value"/>
    <add key="keyvalue1" value="value1"/>
 </appSettings>
 <mySettings>
   <add name="myname" myvalue="value1"/>
 </mySettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)

它显示错误:

Could not find schema information for the element "mySettings"
Could not find schema information for the element "add"
Could not find schema information for the element "myvalue"
Run Code Online (Sandbox Code Playgroud)

c# configuration custom-configuration

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

Server Client应用程序

这是我的服务器代码我有问题,因为我的程序冻结,不知道有什么问题.

   private void button1_Click(object sender, EventArgs e)
    {
        if (button1.Text == "Listen")
        {
            tcpl = new TcpListener(IPAddress.Any, 5555);
            tcpl.Start();

            try
            { 
                // get random word from text
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = "Txt |*.txt";
                ofd.Title = "Tekst";
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    String[] myString = File.ReadAllLines(ofd.FileName);
                    textBox1.Text = myString[r.Next(myString.Length)];
                }

                    Socket socketForClient = tcpl.AcceptSocket();
                    if (socketForClient.Connected)
                    {
                        MessageBox.Show("Client connected" + socketForClient.RemoteEndPoint.ToString());
                        NetworkStream networkStream = new NetworkStream(socketForClient);
                        StreamWriter sw = new StreamWriter(networkStream);
                        StreamReader sr = new StreamReader(networkStream);
                        string line …
Run Code Online (Sandbox Code Playgroud)

c# sockets tcp winforms

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