我正在尝试在IIS7上使用WCF发布Web服务.
我为这个项目创建了一个站点,我也像MSDN建议的那样创建了一个Application .我可以在我的浏览器中从创建的文件夹中打开html文件,但是如果我尝试访问我的服务的svc文件,则会收到404.3错误(由于扩展配置而无法提供请求的页面).我已经读过我应该运行servicemodelreg来为svc文件安装缺少的处理程序.我做了之后,我得到一个错误,说该处理程序有一个坏模块.
我每次检查以下内容:
我的想法用完了......
我有一个由IIS运行的WCF服务.我想创建两个使用相同服务的不同客户端(WPF和WP7).WPF客户端已经使用wsHttpBinding和使用端点https.可悲的是WP7没有做wsHttpBinding,只是BasicHttpBinding.所以我想我会为这两个端口暴露不同的端点,所以他们可以访问相同的服务,但是使用不同的绑定,什么不是......
这是我在IIS上的Web.config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="TransportSecurity">
<reliableSession enabled="true" />
<security mode="TransportWithMessageCredential" >
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
<basicHttpBinding>
<binding name="BasicTransportSecurity">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="SmartCook2.Server.ISmartCookServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service behaviorConfiguration="SmartCook2.Server.ISmartCookServiceBehavior"
name="SmartCook2.Server.SmartCookService">
<endpoint address="WS" binding="wsHttpBinding" bindingConfiguration="TransportSecurity"
name="WS" contract="SmartCook2.Server.ISmartCookService" />
<endpoint address="Basic" binding="basicHttpBinding" bindingConfiguration="BasicTransportSecurity"
name="Basic" contract="SmartCook2.Server.ISmartCookService" />
<endpoint …Run Code Online (Sandbox Code Playgroud) 简而言之:我正在寻找像Roslyn这样的东西而不是C++.
详细地:
我正在处理ac #project,我必须使用c ++文件.我有一堆.h(大约250个文件)和.cpp,我想映射类和函数,以及在这些文件中定义的内容和函数.
它用于建模任务.我不想使用实际的c ++库.
我没有编写c ++代码,所以我无法确定是否有嵌套类.所以这不是一个"简单"的正则表达式任务.
该项目在c#中,我想使用的库是c ++.我无法改变这一点.
我对此感到有些沮丧,也许有人遇到了类似的问题或者想知道如何修复它.
我升级到Windows 10.
我安装了Visual Studio 2015社区.
我创建了一个新的解决方案,只有一个项目用于空白的通用Windows应用程序.我正在使用C#.
问题:
我试图在设计器中打开MainPage.xaml,但设计器不会加载.我NullReferenceException在设计师窗口中得到了一个.我尝试在Blend中打开它,结果相同.正如Visual Studio建议的那样,我尝试关闭"选项"菜单中的"在XAML Designer中运行项目代码"功能,但它没有帮助.
在设计器中打开其他xaml文件没有问题(WPF,Windows Phone 8或8.1 Universal应用程序都可以正常工作).该应用程序在本地计算机上运行,在模拟器中,只有设计师才能执行.
欢迎任何建议.
编辑
设计师窗口的例外情况:
System.NullReferenceException
Object reference not set to an instance of an object.
at Microsoft.VisualStudio.DesignTools.Platform.Metadata.MetadataStore.GetTypeConverter(Type type)
at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties.ResolveImplementation(IPlatformMetadata platformMetadata, DesignTimePropertyId neutralProperty, IType declaringType, PropertyChangedCallback callback)
at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties.RegisterProperty(IPropertyId neutralPropertyKey, IType declaringType, PropertyChangedCallback callback)
at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlCommonDesignTimeProperties.Initialize(WindowsUIXamlDesignTimeProperties designTimeProperties)
at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsUIXamlDesignTimeProperties..ctor(IPlatformTypes platformMetadata)
at Microsoft.VisualStudio.DesignTools.UniversalXamlDesigner.UniversalXamlPlatformMetadata.CreateDesignTimeProperties()
at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.Metadata.WindowsUIXamlPlatformMetadata.Initialize()
at Microsoft.VisualStudio.DesignTools.WindowsXamlDesigner.WindowsStoreXamlPlatform.Initialize()
at Microsoft.VisualStudio.DesignTools.Platform.PlatformCreatorBase.CreatePlatform(IPlatformReferenceAssemblyResolver referenceAssemblyResolver)
at Microsoft.VisualStudio.DesignTools.Designer.Project.ProjectContextManager.GetProjectContext(IHostProject project, IPlatform platform, Boolean create)
at Microsoft.VisualStudio.DesignTools.Designer.Project.ProjectContextManager.GetSourceItemContext(IHostSourceItem sourceItem)
at Microsoft.VisualStudio.DesignTools.Designer.DesignerService.CreateDesigner(IHostSourceItem item, IHostTextEditor editor, …Run Code Online (Sandbox Code Playgroud) 这可能是一个愚蠢的问题,但我找不到答案.
我想做什么:我有一个由IIS托管的WCF服务.它工作得很好,我可以访问wsdl,我有一个服务器的自签名证书等.我想从WPF客户端调用此服务.
问题是,由于我有自签名证书,因此在调用服务时出现以下异常: 无法为具有权限"localhost"的SSL/TLS安全通道建立信任关系.
如果我从浏览器访问该站点(或服务),这没有问题,因为浏览器警告我有关证书,并让我选择查看页面.但WPF客户端只是抛出异常.
我不想完全关闭身份验证过程,我只想让用户选择忽略此警告(就像浏览器那样).
任何人都可以为此提供一些代码吗?如果你遇到一个关于这个的好的,详细的教程,它也会很棒.(看,我发现的教程问题是缺乏细节)
我必须制作一个黑暗的银色UI.这是一种痛苦,所有控制都是黑色的,文本是白色的.我也想改变TextBoxes中的插入符号颜色.由于我不想讨论的原因,我为TextBoxes创建了一个Style(名为BaseTextBoxStyle),我也为它们创建了一个隐式Style,这是基于前面提到的BaseTextBoxStyle.我使用"编辑复制"命令编辑了所有Styles和Templtes with Blend,我不会更改模板中的任何内容,只会更改颜色和画笔.
现在我的TextBoxes和我玩一个有趣的游戏.它们使插入符号消失.我试图在这些消失中识别出一种模式,但我唯一知道的是,我点击的第一个TextBox显示了插入符号.但是一些点击之后,插入符号从一些(或有时是全部)TextBox中消失.(它不会切换回黑色,也不会出现在框中.)
如果我单独离开CaretBrush,则不会出现此问题.但那时它是黑色的,所以我几乎看不到它.什么可能导致这样的事情?
这是XAML:
<Style x:Key="BaseTextBoxStyle" TargetType="TextBox">
<Setter Property="CaretBrush" Value="{StaticResource SolidHighBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Background" Value="{StaticResource LinearMain}"/>
<Setter Property="BorderBrush" Value="{StaticResource LinearBase}"/>
<Setter Property="Foreground" Value="{StaticResource SolidStrongBrush}"/>
<Setter Property="SelectionBackground" Value="{StaticResource SolidHigh2Brush}"/>
<Setter Property="Padding" Value="2"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Grid x:Name="RootElement">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Duration="0" To="#FF454545" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="MouseOverBorder"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement"/>
</Storyboard>
</VisualState>
<VisualState x:Name="ReadOnly">
<Storyboard>
<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ReadOnlyVisualElement"/>
</Storyboard>
</VisualState> …Run Code Online (Sandbox Code Playgroud) 在我的WPF项目中,我有一点复杂的控制.在项目中我只使用Controls(它们都是模板化的),除了MainWindow.
在一个屏幕上,我有以下布局(用于显示模板应用和填充内容后的布局):
MyScreenControl
-MyTableControl
--ItemsControl
--- HeaderItemsControl
----- HeaderItemsControl.Header
------ MyHeaderControl
----- HeaderItemsControl.Items
------ MyItemControl
------ MyItemControl
--- --- MyItemControl
......
当我在ScreenControl的代码文件中时,在OnMouseLeftButtonDown方法中,我想确定click事件是来自MyHeaderControl还是MyItemControl.
MouseButtonEventArgs的Source是ScreenControl,OriginalSource是MyItemControl/MyHeaderControl模板中的TextBlock.
我第一次尝试找到MyItemControl/MyHeaderControl是从OriginalSource开始,并递归地查看Parent属性的类型.它工作正常,直到我到达模板的根(在这种情况下是一个ViewBox),但根没有父元素.
我在我早期的z项目中使用了这样的方法并且它有效,但后来我使用的是UserControls,而不是Controls,也没有模板.
任何想法我应该如何处理这个问题(一个好主意是作为代码的好结果)?
thx,Tenshiko
我想将 User.Password 属性绑定到 PasswordBox (TwoWay)。由于PasswordBox.Password 不可绑定,我制作了 AttachedProperties 来解决此问题(一个用于激活绑定,一个用于保存实际密码)。问题是它们不会绑定(GetBindingExpression 返回 null)。
还:
以下是附加属性:
public static bool GetTurnOnBinding(DependencyObject obj)
{
return (bool)obj.GetValue(TurnOnBindingProperty);
}
public static void SetTurnOnBinding(DependencyObject obj, bool value)
{
obj.SetValue(TurnOnBindingProperty, value);
}
// Using a DependencyProperty as the backing store for TurnOnBinding. This enables animation, styling, binding, etc...
public static readonly DependencyProperty TurnOnBindingProperty =
DependencyProperty.RegisterAttached(
"TurnOnBinding",
typeof(bool),
typeof(PasswordHelper), …Run Code Online (Sandbox Code Playgroud) 我正在使用Metro XAML应用程序搞乱一些故事板.我必须创建一个Storyboard代码.我想设置Storyboard.TargetProperty为CompositeTransform.Rotation
这似乎不可能......
我在XAML中的故事板看起来像这样:
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.Rotation)" Storyboard.TargetName="grid">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="60"/
</DoubleAnimationUsingKeyFrames>
</Storyboard>
Run Code Online (Sandbox Code Playgroud)
我想创造类似的东西.
重要提示:我不是要重新创建这个确切的故事板.我在自定义的代码中ContentControl,所以this是Control,并且没有"网格"来定位动画.目标是控制本身,它已经CompositeTransform预先设定.
到目前为止我的代码是这样的:
var turnSB = new Storyboard();
var doubleAnim = new DoubleAnimationUsingKeyFrames();
doubleAnim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromMilliseconds(0), Value = currentAngle });
doubleAnim.KeyFrames.Add(new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromMilliseconds(500), Value = targetAngle });
turnSB.Children.Add(doubleAnim);
Storyboard.SetTarget(doubleAnim, this.RenderTransform);
Storyboard.SetTargetProperty(doubleAnim, "(CompositeTransform.Rotation)");
turnSB.Begin();
Run Code Online (Sandbox Code Playgroud)
一旦它遇到Begin方法,我得到一个Exception,说无法解决(CompositeTransform.Rotation).所以我猜我没有完全正确的属性路径.我尝试了不同的变化,但根据PropertyPaths,这应该是正确的,不应该吗?:S
如果这是一个无法解决的问题,我愿意接受有关解决方法的建议......
编辑:
我想我现在已经解决了这个问题.我有一些有趣的发现......
如果我制作一个UserControl,我几乎可以做任何事情.一切正常,我可以设置Storyboard.Targetproperty,动画播放正确.
但是,如果我使用自定义控件,或从其他控件(比如ContentControl)继承,我无法从代码启动Storyboard,仅在某些情况下.
例如:如果我创建一个故事板(在XAML中定义)来为Rotation(或任何转换属性)设置动画并尝试从代码开始,我会得到上述异常.但是,如果我为一个简单的属性设置动画,比如Opacity,那就可以了.
(我对UserControl做了同样的事情,并且它有效.)
有人可以解释一下吗?
wcf ×3
wpf ×3
c# ×2
iis-7 ×2
binding ×1
c++ ×1
data-binding ×1
https ×1
iis ×1
modeling ×1
onmouseclick ×1
parent ×1
storyboard ×1
templates ×1
textbox ×1
web-config ×1
web-services ×1
winrt-xaml ×1
wpf-controls ×1