小编Max*_*r88的帖子

HTTP错误404.3-在IIS 7.5中找不到

我在Windows Server 2008 R2 x64企业版上使用IIS 7.5.在我们使用ASP.NET 4.0开发的项目中,我们使用了WCF服务.但是当软件从本地计算机运行时,它不会在域上运行.否则,我收到以下错误:

HTTP错误404.3-未找到

由于扩展配置,无法提供您请求的页面.如果页面是脚本,请添加处理程序.如果要下载文件,请添加MIME映射.

iis-7.5 mime-types

63
推荐指数
3
解决办法
17万
查看次数

如何从控制台读取用户输入?

我想从用户那里得到一个数字,然后将该数字乘以Pi.我对此的尝试如下.但a包含胡言乱语.例如,如果我插入22,则a包含50.我究竟做错了什么?我没有得到任何编译器错误.

double a,b;
a = Console.Read();
b = a * Math.PI;
Console.WriteLine(b);
Run Code Online (Sandbox Code Playgroud)

.net c# console

41
推荐指数
3
解决办法
35万
查看次数

如何使用LINQ to XML包含CData?

我想用ASP.Net中的那些代码记录到XML.但是,我想<![[CDATA]]> 在第五个元素中添加 .当我按照下面所示进行创建时,它创建的""&"bt;"不是>字符""&"lt;"而是字符而不是<XML.如何摆脱这个问题?

码:

XElement xml = new XElement("photo",
        new XElement("thumbnail", TextBox1.Text),
        new XElement("filename", TextBox2.Text),
        new XElement("baslik1", TextBox3.Text),
        new XElement("baslik2", TextBox4.Text),
        new XElement("description","<>"+TextBox5.Text),
        new XElement("link", TextBox6.Text),
        new XElement("fiyat1", TextBox7.Text),
        new XElement("indorani", TextBox8.Text));

XDocument doc = XDocument.Load(Server.MapPath("~/App_Data/satislar.xml"));

doc.Root.Add(xml);

doc.Save(Server.MapPath("~/App_Data/satislar.xml"));

Response.Write("kay?t eklendi");
new XElement("description","<>"+TextBox5.Text),
Run Code Online (Sandbox Code Playgroud)

xml linq-to-xml

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

Ramer-Douglas-Peucker路径简化算法

我在阅读这篇文章后实现了路径简化算法:

http://losingfight.com/blog/2011/05/30/how-to-implement-a-vector-brush/

它对我来说非常适合为我的游戏生成优化的关卡几何体.但是,我现在正在使用它来清理一个*寻路路径,它有一个奇怪的边缘情况,惨遭失败.

这是它工作的截图 - 优化从红色圆圈到蓝色圆圈的路径.淡绿色线是a*输出,浅白色线是优化路径.

在此输入图像描述

这是一个失败的屏幕截图:

在此输入图像描述

这是我的代码.我将文章中的ObjC代码改编为c ++

注意:vec2fvec是a std::vector< vec2<float> >,'real'只是一个typedef'd float.

       void rdpSimplify( const vec2fvec &in, vec2fvec &out, real threshold )
{
    if ( in.size() <= 2 )
    {
        out = in;
        return;
    }

    //
    //  Find the vertex farthest from the line defined by the start and and of the path
    //

    real maxDist = 0;
    size_t maxDistIndex = 0;      
    LineSegment line( in.front(), in.back() );

    for ( vec2fvec::const_iterator it(in.begin()),end(in.end()); it != end; ++it …
Run Code Online (Sandbox Code Playgroud)

c++ algorithm debugging

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

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

用C#捕捉电视卡的声音

我编写了一个WPF应用程序,它通过C#代码从电视卡中捕获显示和声音.我可以从电视卡上看到显示器,但我无法从电视卡中获得任何声音.顺便说一句,我在Visual Studio 2010中使用.NET framework 3.5.我的问题是如何从电视卡中获取声音?

最后,我通过使用DirectX的DirectSound库尝试了类似下面的任何内容.但是,我收到了以下错误.

  1. 最好的重载方法匹配 'Microsoft.DirectX.DirectSound.Device.SetCooperativeLevel(System.Windows.Forms.Control, Microsoft.DirectX.DirectSound.CooperativeLevel)'有一些无效的参数.
  2. 参数1:无法转换'Wpfvideo.MainWindow''System.Windows.Forms.Control'

码:

private DS.Device soundDevice;
private SecondaryBuffer buffer;
private ArrayList soundlist = new ArrayList();

private void InitializeSound()
{
     soundDevice = new DS.Device();
     soundDevice.SetCooperativeLevel(this, CooperativeLevel.Priority);

    BufferDescription description = new BufferDescription();
    description.ControlEffects = false;
    buffer = new SecondaryBuffer(CaptureDeviceName, description, soundDevice);
    buffer.Play(0, BufferPlayFlags.Default);
    SecondaryBuffer newshotsound = buffer.Clone(soundDevice);
    newshotsound.Play(0, BufferPlayFlags.Default);
} 
Run Code Online (Sandbox Code Playgroud)

c# directx wpf

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

通过C#发送屏幕截图

通过该代码捕获屏幕截图来保存.

Graphics Grf;
Bitmap Ekran = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppPArgb);
Grf = Graphics.FromImage(Ekran);
Grf.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
Ekran.Save("screen.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
Run Code Online (Sandbox Code Playgroud)

然后将此保存的屏幕截图作为电子邮件发送:

SmtpClient client = new SmtpClient();
MailMessage msg = new MailMessage();
msg.To.Add(kime);
if (dosya != null)
{
   Attachment eklenecekdosya = new Attachment(dosya);
   msg.Attachments.Add(eklenecekdosya);
}
msg.From = new MailAddress("aaaaa@xxxx.com", "Konu");
msg.Subject = konu;
msg.IsBodyHtml = true;
msg.Body = mesaj;
msg.BodyEncoding = System.Text.Encoding.GetEncoding(1254);
NetworkCredential guvenlikKarti = new  NetworkCredential("bbbb@bbbb.com", "*****");
client.Credentials = guvenlikKarti;
client.Port = 587;
client.Host = "smtp.live.com";
client.EnableSsl = true; …
Run Code Online (Sandbox Code Playgroud)

c# smtp

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

使用dispose()方法而不是close()方法来表单

当我关闭一个使用的表单时Show(),通过使用Dispose()而不是Close()?来发生什么?有人可以详细告诉我,Dispose()方法中发生了什么?

winforms

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

方法参数C#

我在C#中编写了这样的方法.

 MethodBase method = MethodBase.GetCurrentMethod();
 string key ="";
 for (int i = 0; i < method.GetParameters().Length; i++)
 {
     key=method.GetParameters().Name;
     // need value of parameter here             
 } 
Run Code Online (Sandbox Code Playgroud)

我通过上面的代码获取参数名称.我的问题是:如何获取我方法中的参数值?

c# reflection

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

C#得到模糊的Active Directory属性

我正在尝试检索一些令人沮丧的Active Directory属性:

  1. msexchmailboxsecuritydescriptor,和
  2. terminalservicesprofilepath(在userparameters中)

我很难找到他们两个.

例如,对于msexchmailboxsecuritydescriptor,如果我的代码类似于以下内容:

DirectoryEntry deresult = result.GetDirectoryEntry();
byte[] bteMailACL =(byte[])deresult.Properties["msexchmailboxsecuritydescriptor"].Value; 
Run Code Online (Sandbox Code Playgroud)

它抱怨我不能将System .__ ComObject强制转换为System.Byte [],但我看到了几个使用类似上面代码的例子.

我如何理解这些信息?

c# active-directory

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