小编JTI*_*TIM的帖子

Azure自定义控制器/ API .Net后端

我在Azure上运行了一个MobileService,并决定创建一个新服务并自己迁移代码.新服务属于新类型:Azure Mobile App Service.

目前我有身份验证工作,可以进行迁移/更新数据库.我正在关注TodoItem示例.我现在想要创建自己的自定义API,它可以轻松地在MobileService上运行,但我无法在Azure Mobile App上运行它:/

我已经关注了这两个链接web-Api-routingapp-service-mobile-backend.我现在有以下内容:

我创建了一个新的控制器:

[MobileAppController]
public class TestController : ApiController
{
    // GET api/Test
    [Route("api/Test/completeAll")]
    [HttpPost]
    public async Task<ihttpactionresult> completeAll(string info)
    {
        return Ok(info + info + info);
    }
}
Run Code Online (Sandbox Code Playgroud)

在mobileApp.cs中,我根据后端添加了以下代码:

HttpConfiguration config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
Run Code Online (Sandbox Code Playgroud)

另外我根据web-api-routing安装了以下软件包:

Microsoft.AspNet.WebApi.WebHost 
Run Code Online (Sandbox Code Playgroud)

和来自客户的电话:

string t = await App.MobileService.InvokeApiAsync<string,string>("Test/completeAll", "hej");
Run Code Online (Sandbox Code Playgroud)

调试显示,它是正确的URL:

{方法:POST,RequestUri:' https ://xxxxxxx.azurewebsites.net/api/Test/completeAll',版本:1.1,内容:System.Net.Http.StringContent,标题:{X-ZUMO-FEATURES:AT X -ZUMO-INSTALLATION-ID:e9b359df-d15e-4119-a4ad-afe3031d8cd5 X-ZUMO-AUTH:xxxxxxxxxxx接受:application/json User-Agent:ZUMO/2.0 User-Agent:(lang = Managed; os = Windows Store; os_version = - ; arch = …

c# asp.net azure azure-mobile-services azure-api-apps

31
推荐指数
2
解决办法
7863
查看次数

从内存中删除项目/页面/用户控件

我做了一个Windows手机应用程序,不幸的是有一些内存泄漏,因为页面没有正确删除.通过使用答案解决了这个问题:

删除页面Windows phone 说明:

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
while (App.RootFrame.RemoveBackEntry() != null) ; //line if you navigate without backkey
base.OnNavigatedTo(e);

this.Dispatcher.BeginInvoke(() =>
{
    GC.Collect();
    GC.WaitForPendingFinalizers();

    this.Dispatcher.BeginInvoke(() =>
    {
        GC.Collect();
        GC.WaitForPendingFinalizers();

        this.Dispatcher.BeginInvoke(() =>
        {
            GC.Collect();
            GC.WaitForPendingFinalizers();
        });
    });
Run Code Online (Sandbox Code Playgroud)

}

这从分析器中删除了页面引用.但是导航时内存仍然增加了一些.并且增加记忆的来源并不明显.因此,我尝试引入一个空白项目并导航到星空导航,如下所示:

在此输入图像描述

这使得移除了超过20 mb的视觉效果和其他元素.所以这是一个重要的步骤.因此,我希望将功能分解到不同的项目中,以消除不同功能之间的任何联系并保持较低的内存使用率.最终得到以下结构:

  • 网络服务
  • MainProject
  • SecondaryProject
  • PortableLibrary

我使用Portable Library在所有项目之间共享模型.这影响了每次导航到新项目时,旧项目中的所有内容都被清除,即每个项目只有一个元素存在,主要内存改进.但仍有一些内存泄漏,无论多么有限,意味着内存只有一定的增加.但内存来自哪里?回到探查器:

在此输入图像描述

这表明页面没有被特定删除,所有元素.view.将被一个项目中所有页面的配置中的代码删除.但是内存泄漏是类似的.

问题

  1. 如何在同一解决方案中从其他项目中删除页面和元素?
  2. 如何从内存中删除项目?

两个项目之间没有共享信息,除了它们都可以创建一个版本LibraryOfModels.因此,项目边界不会共享任何事件,变量或引用.但对于我的生活,我无法将它从记忆中删除.我想将它们从内存中删除,因为我的代码片段位于顶部,如果导航仅在一个项目中.问题的存在是因为导航分布在两个项目上.但它在其他领域有一些记忆优势,这就是我想要这种结构的原因.

希望有人可以提供帮助.谢谢!

附加测试

我已经尝试使所有页面用户控制,以便我可以避免导航.但重建它们几次gav稳定泄漏1-2 Mb.因此,项目理念仍然是最好的,因为有一个限制.但仍然没有解决方案将其删除.

仍然希望骑士与闪亮的键盘;)

c# memory visual-studio windows-phone windows-phone-8

21
推荐指数
1
解决办法
611
查看次数

将wp8升级到wp8.1 silverlight,调试器无法启动

我现在已经有VS2013和WP8.1 silverlight的错误了几天.

我得到了几个不同的错误,..Ensure unlocked screen..,AgHost.exe could not be launched,port is in use by another programensure the device is unlocked.

在我解除了解决方案之后突然出现了这些错误.我没有编译错误. 解决方案尝试

  1. 重启电脑
  2. 重启程序
  3. 取消注册并重新注册手机
  4. 重新安装更新3
  5. 重新安装VS2013
  6. Windows Phone 8应用程序崩溃一旦其启动AgHost.exe已退出,代码为-532265403
  7. 安装VS2015没有运气.
  8. 重新安装VS2013 Update 4

没有任何效果.仿真器和不同设备的错误也相同.然而,我可以release mode安装.使用时可以使用断点release mode,但我必须Clean,Rebuild然后deploy每次我想部署应用程序.此外,部署时间呈指数增长.在升级之前,我使用了最多10秒.现在等待时间超过一分钟.:/

有人有解决方案吗?

额外

如果我在升级设备或仿真器之前运行解决方案它会使用调试器旋转.如果然后转到更新的WP81,我会获得一个包含信息的弹出窗口,Something is taking longer then normal然后它崩溃了..Ensure unlocked screen..:/

这可能是差异SDKS的问题吗? 在此输入图像描述 在修复所有SDK的过程中,我发现事件日志存在问题,我根据事件日志文件已经清除了该问题

仍然没有成功.

额外

在使用WP8.1解决方案时,我无法从VS2013启动模拟器,但同一VS中的wp8.0解决方案可以工作:S

我在日志文件中发现了一个错误,来自:

在此输入图像描述

错误是:

[0F08:14a8中] [2015-07-23T09:11:44]:应用执行包:silverlight5_DRT,动作:修理,路径:C:\ …

c# silverlight windows-phone-8 visual-studio-2013 windows-phone-8.1

15
推荐指数
2
解决办法
416
查看次数

抑制系统覆盖,Windows Phone 8.1(Silverlight)

我想知道如何隐藏导航栏.如果可以在XAML中指定代码SuppressSystemOverlay,就像使用systemtray一样:shell:SystemTray.IsVisible="False".

我甚至无法在msdn上找到描述,这似乎是指使用WinRT构建的wp 8.1,而我的应用程序是使用silverlight.

c# silverlight xaml overlay

13
推荐指数
1
解决办法
411
查看次数

pip升级无法安装包

我已经跳了一段时间来解决这个问题,但我似乎无法让它工作。我有一个 docker 容器,我在其中设置了一个用于机器学习的 nvidia 映像。我安装了所有 python 依赖项。然后我从 pip 包安装开始。我得到第一个错误:

requests.exceptions.SSLError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),))
Run Code Online (Sandbox Code Playgroud)

简单到我有一把certificate对付思科的伞。然后,我可以轻松轻松地安装所有软件包。但是为了能够安装最新的软件包,我需要升级 pip,并且升级工作正常。pip升级到后20.2.3突然又报错:

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),)) - skipping
Run Code Online (Sandbox Code Playgroud)

然后我用谷歌搜索并尝试了我偶然发现的建议:

定时

我发现系统时间是错误的 - 它适用于初始 pip 版本,这很奇怪。然而,改变时间并没有帮助这个问题。

配置文件

pip.conf为受信任的主机和认证添加了一个带有全局标签的文件。同样的错误仍然存​​在。

点安装

我尝试过使用不同的受信任主机标志以及证书标志,如果我理解正确的话,它应该已经从 conf 文件中指定了。然而,这两种方法都没有奏效。 …

python pip ssl-certificate docker

10
推荐指数
1
解决办法
712
查看次数

设计ListPicker Blend/Xaml

我正在使用ListPicker,但很难让设计工作.我已经包括了我做过的测试:

 <ControlTemplate x:Key="listpicker_style" TargetType="toolkit:ListPicker">
        <StackPanel>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="PickerStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="Highlighted">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames
                                Storyboard.TargetName="UserControl"
                                Storyboard.TargetProperty="Foreground"
                                Duration="0">
                                <DiscreteObjectKeyFrame
                                    Value="{StaticResource PhoneTextBoxForegroundBrush}"
                                    KeyTime="0"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames
                                Storyboard.TargetName="Border"
                                Storyboard.TargetProperty="Background"
                                Duration="0">
                                <DiscreteObjectKeyFrame
                                    Value="{StaticResource PhoneTextBoxEditBackgroundColor}"
                                    KeyTime="0"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames
                                Storyboard.TargetName="Border"
                                Storyboard.TargetProperty="BorderBrush"
                                Duration="0">
                                <DiscreteObjectKeyFrame
                                    Value="{StaticResource PhoneTextBoxEditBorderBrush}"
                                    KeyTime="0"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames
                                Storyboard.TargetName="Border"
                                Storyboard.TargetProperty="Background"
                                Duration="0">
                                <DiscreteObjectKeyFrame
                                    Value="{StaticResource TransparentBrush}"
                                    KeyTime="0"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames
                                Storyboard.TargetName="Border"
                                Storyboard.TargetProperty="BorderBrush"
                                Duration="0">
                                <DiscreteObjectKeyFrame
                                    Value="{StaticResource PhoneDisabledBrush}"
                                    KeyTime="0"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames
                                Storyboard.TargetName="UserControl"
                                Storyboard.TargetProperty="Foreground"
                                Duration="0">
                                <DiscreteObjectKeyFrame
                                    Value="{StaticResource PhoneDisabledBrush}"
                                    KeyTime="0"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <ContentControl
                Content="{TemplateBinding Header}"
                ContentTemplate="{TemplateBinding …
Run Code Online (Sandbox Code Playgroud)

c# xaml expression-blend listpicker windows-phone-8

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

交互时xaml解析错误触发wp8.1(silverlight)

我有一个WP8.0的工作解决方案.但我需要升级才能访问WNS.我已成功将WNS添加到主菜单中的升级解决方案中.但在升级到wp8.1(silverlight)之后,我遇到了一些奇怪的错误,这只发生在运行时.作为示例,它发生在以下usercontrol中:

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform"
xmlns:View="clr-namespace:ShieldGenerator.View"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
x:Class="ShieldGenerator.View.MoveableShieldGear"
mc:Ignorable="d"
Canvas.Left="{Binding Gear.x}" Canvas.Top="{Binding Gear.y}" Canvas.ZIndex="{Binding Gear.z}" >

<Path Data="{Binding Gear.Path}" Fill="{Binding Gear.Color}" Stretch="Fill" UseLayoutRounding="False" Height="{Binding Gear.Height}" Width="{Binding Gear.Width}" Opacity="{Binding Gear.Opacity}">
    <Path.RenderTransform>
        <TransformGroup>
            <ScaleTransform ScaleX="{Binding Gear.Scale}" ScaleY="{Binding Gear.Scale}" CenterX="{Binding Gear.CenterX}" CenterY="{Binding Gear.CenterY}"/>
            <RotateTransform Angle="{Binding Gear.Rotate}" CenterX="{Binding Gear.CenterX}" CenterY="{Binding Gear.CenterY}" />
            <SkewTransform AngleX="{Binding Gear.SkewX}" AngleY="{Binding Gear.SkewY}" CenterX="{Binding Gear.CenterX}" CenterY="{Binding Gear.CenterY}" />
        </TransformGroup>
    </Path.RenderTransform>

    <i:Interaction.Triggers>

        <i:EventTrigger EventName="ManipulationStarted">
            <cmd:EventToCommand Command="{Binding MouseDownGearCommand}" PassEventArgsToCommand="True"/>
        </i:EventTrigger>

        <i:EventTrigger  EventName="ManipulationDelta">
            <cmd:EventToCommand Command="{Binding MouseGearMoveCommand, Mode=OneWay}" PassEventArgsToCommand="True"/>
        </i:EventTrigger>

        <i:EventTrigger …
Run Code Online (Sandbox Code Playgroud)

c# silverlight xaml mvvm-light windows-phone-8.1

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

WNS推送仅发送到某些标签

大纲

我正在尝试为我的应用游戏实施WNS.我目前在创建具有以下功能的新用户时发送通知,该功能有效:

public async void SendNotificationToTag(string tag, string content)
{
    var wnsToast = "<toast><visual><binding template=\"ToastText01\">"
        + "<text id=\"1\">Breaking " +content + "An WNS News!"
        + "</text></binding></visual></toast>";

    WindowsPushMessage wnsMessage = new WindowsPushMessage();
    wnsMessage.XmlPayload = wnsToast;

    await Services.Push.HubClient.SendWindowsNativeNotificationAsync(wnsToast, tag);
    Services.Log.Info("WNS TEST - SendWindowsNativeNotificationAsync - done");
}
Run Code Online (Sandbox Code Playgroud)

我得到了每个用户名的通知,即个人通知.然后我更新用户监听的标签,查看集线器数据库,这似乎也有效:

  1. -Usernamecph - gameID1151 - gameID1152 - gameID1153 - gameID1154 - gameID1155 - gameID1156 - gameID1157 - gameID1158
  2. -gameID1157 - UsernameFyn - gameID1151 - gameID1153 - gameID1155 - gameID1156-

使用此检查从集线器中提取标签

foreach (Microsoft.ServiceBus.Notifications.RegistrationDescription t in a)
{ …
Run Code Online (Sandbox Code Playgroud)

c# azure push-notification azure-notificationhub wns

9
推荐指数
0
解决办法
361
查看次数

ViewportControl捏缩放中心

Hej我正在玩一个使用MVVM的Windows Phone 8应用程序.

我有一个问题,即获取捏缩放的中心并完全理解视口控制器上的边界.最后重新配置viewportcontroller以仍然滚动整个图片.我的xaml代码是:

<Grid>
    <StackPanel>
        <ViewportControl Bounds="0,0,1271,1381.5" Height="480" Width="800" CacheMode="BitmapCache" RenderTransformOrigin="{Binding KontaktPunkter}" Canvas.ZIndex="1">
            <ViewportControl.RenderTransform>
                <CompositeTransform x:Name="myTransform" ScaleX="1" ScaleY="1" TranslateX="0" TranslateY="0" />
            </ViewportControl.RenderTransform>

            <View:Picture/>

        </ViewportControl>


    </StackPanel>
    <View:PopUpUC DataContext="{Binding PopUp}"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)

据我所知,Bounds是我想要滚动的区域,而高度和宽度是控件的窗口尺寸是正确的吗?

回答是的,这是正确的.

到第二部分:)获取捏缩放运动的中心.

public void ZoomDelta(ManipulationDeltaEventArgs e)
    {

        FrameworkElement Element = (FrameworkElement)e.OriginalSource;
        ViewportControl Picture;
        Grid PictureGrid;
        double MainWidth = Application.Current.RootVisual.RenderSize.Height;
        double MainHeight = Application.Current.RootVisual.RenderSize.Width;

        if (Element is ViewportControl)
        {
            Picture = Element as ViewportControl;
        }
        else
        {
            Picture = FindParentOfType<ViewportControl>(Element);
        }

        if (Element is Grid)
        {
            PictueGrid = Element …
Run Code Online (Sandbox Code Playgroud)

c# zoom viewport mvvm windows-phone-8

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

两个应用程序的相同表,通知中心和服务器

我们被微软放弃Silverlight并专注于UWP而陷入困境.最终我们不得不开发两个双重关注的应用程序(UWP和Silverlight),这给我们带来了两个无法捆绑/打包在一起的应用程序.因此,我们决定将这些应用作为配套应用.

这两个应用程序都使用身份验证,目前它使用Microsoft身份验证.用于身份验证的服务属于该类型Azure App Service - Mobile.除身份验证之外的服务还提供通知集线器,blob存储和SQL存储的接口.

因此,问题是是否可以拥有一个App Service - Mobile(不是移动服务),并使用相同的服务验证两个不同的应用程序?此外,可以使用相同的通知中心向不同的应用发送通知吗?

或者我们需要为每个应用程序创建两个不同的服务,以便于使用身份验证和推送消息.然后我们可以将同一个数据库链接到两个App Service - Mobile?但这会使通知中心的问题没有相同的注册?

azure azure-notificationhub azure-web-app-service

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