小编The*_*lTy的帖子

Wcf基本身份验证

使用简单的测试Wcf服务使用基本身份验证时遇到一些麻烦.我得到一个例外:

无法激活所请求的服务"http://qld-tgower/test/Service.svc".有关详细信息,请参阅>服务器的诊断跟踪日志.

在跟踪日志中显示:

主机上配置的身份验证方案("基本")不允许在绑定"BasicHttpBinding"("匿名")上配置的身份验证方案.请确保将SecurityMode设置为Transport或TransportCredentialOnly.此外,可以通过IIS管理工具,在<serviceAuthenticationManager>元素的应用程序配置文件中,通过更新绑定上的ClientCredentialType属性,通过ServiceHost.Authentication.AuthenticationSchemes属性更改此应用程序的身份验证方案来解决此问题.或者通过调整HttpTransportBindingElement上的AuthenticationScheme属性.

但是,我不知道,当我我们不正确的用户名和密码,它说,它IS使用基本身份验证?

HTTP请求未经授权使用客户端身份验证方案"Basic".从服务器收到的验证头是'Basic realm ="qld-tgower"'.

这是我的web.config详细信息

<system.serviceModel>
<services>
  <service name="WcfService"
      behaviorConfiguration="Behavior">
    <endpoint address="http://QLD-TGOWER/test/Service.svc"
              binding="basicHttpBinding"
              bindingConfiguration="httpBinding"
              contract="IService" />
  </service>
</services>
<diagnostics>
  <endToEndTracing activityTracing="false" messageFlowTracing="true" propagateActivity="true"></endToEndTracing>
</diagnostics>
<bindings>
  <basicHttpBinding>
    <binding name="httpBinding">
      <security mode="TransportCredentialOnly">
        <transport  clientCredentialType="Basic" proxyCredentialType="Basic">
        </transport>
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, …
Run Code Online (Sandbox Code Playgroud)

wcf basichttpbinding

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

MVC DropDownListFor()所选项目未选中/必需验证未运行

我无法让我的DropDownList将所选项目设置为模型中的值.

模型中的字段只是用户名称标题的字符串(Mr,Miss等..)以下是我的代码.

<td>
@{ var list = new List<SelectListItem>(new[] {                    
    new SelectListItem{ Selected = string.IsNullOrEmpty(Model.Title), Text="",Value=""},
    new SelectListItem{ Selected = Model.Title.Equals("Mr"), Text="Mr",Value="Mr"},
    new SelectListItem{ Selected = Model.Title.Equals("Mrs"),   Text="Mrs",Value="Mrs"},
    new SelectListItem{ Selected = Model.Title.Equals("Miss"), Text="Miss",Value="Miss"},
    new SelectListItem{Selected = Model.Title.Equals("Ms"), Text="Ms",Value="Ms"}       
    });
}
@Html.DropDownListFor(m=>m.Title, list)
</td>
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc-3

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

System.ComponentModel.Win32Exception (0x80004005): 不支持此类接口

由 Windows 服务启动的程序有问题。

流程是

  • exe启动
  • 将自身重命名为 *.bak
  • 下载自身的最新版本
  • 电话 Restart()
  • 执行一堆文件和 SQL 操作(更新我们的主要软件套件)
  • 然后调用 Restart()
  • 流程再次开始。如果主套件没有软件更新,则不会重新启动

除了一个客户站点外,这一切都很完美

在一个站点上,第一个Restart()有效,但第二个总是抛出异常。

System.ComponentModel.Win32Exception (0x80004005): System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at UpdateCompanionService.Program.Restart() 不支持这样的接口

它是一个 WS2008 标准服务器。

public static void Restart()
{
  try
  {
      var procPath = Path.Combine(Config.UpdateCompanionDirectory, "UpdateCompanionService.exe");
      Logger.Debug("Starting procecss {0}", procPath);

      var proc = new Process
      {
          StartInfo = {FileName = procPath, WorkingDirectory = Config.UpdateCompanionDirectory, Arguments = "/noupdate", UseShellExecute = true}
      };

      proc.Start();
      Environment.Exit(-1);
  }
  catch (Exception e)
  {
      Logger.Fatal("Error restarting update companion", …
Run Code Online (Sandbox Code Playgroud)

.net c# process windows-server-2008

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

jQuery .focusOut()取决于下一个选定元素的条件操作

我有一个带有文本输入#usernameInput和链接的表格单元格#saveLink.使用jQuery我有一个分配给click事件的函数#saveLink.

我想要实现的是,当#usernameInput失去焦点时我想隐藏它.除非失去焦点#saveLink.换句话说,如果用户点击#saveLink我要隐藏的#usernameInput其他地方,否则请在上面调用click事件#saveLink.

我没有问题处理,$('#usernameInput').focusout()但我无法检测是否单击了保存链接.

这是我到目前为止所拥有的.

<script type="text/javascript">

$('#usernameInput').focusout(function ()
{

    if (!$('#saveLink').is(':focus'))
    {
        $('#usernameInput').hide();
    }
    return;

});</script>
Run Code Online (Sandbox Code Playgroud)

jquery

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

MonoDroid:Fragment.Instantiate ClassNotFoundException

我正在尝试使用Mono for Android中的ActionBar创建一个滑动标签视图.

eclipse插件的adroid将此作为默认项目模板,我已设法将其转换,我现在正尝试添加功能以将我的片段分开.

当我尝试运行我的项目时,我得到一个ClassNotFoundException

这是片段的代码

using Fragment = Android.Support.V4.App.Fragment;

namespace MobileCompanion.AndroidOS.App.UI.Customers
{
    public  class HomeTab : Fragment
    {
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup viewGroup, Android.OS.Bundle p2)
        {

            return null;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的部分适配器

using System.Collections.Generic;
using Android.Content;
using Android.OS;
using Android.Support.V4.App;
using Java.Lang;

namespace MobileCompanion.AndroidOS.App
{
    public class SectionsPagerAdapter : FragmentPagerAdapter
    {
        private readonly Context _context;
        public readonly IList<TabInfo> Tabs = new List<TabInfo>();
        private Bundle _bundle;

        public SectionsPagerAdapter(FragmentManager fm, Context context, Bundle savedInstanceState)
            : base(fm)
        {
            this._context = …
Run Code Online (Sandbox Code Playgroud)

mono android xamarin.android

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