I have followed and then modified the code given in the following sources
Lambda code
Front end code
CORS
General walkthrough
But when I try and upload an image using the code below...
public void UploadObject(Stream jpeg_image)
{
var buffer = new byte[8000];
HttpWebRequest httpRequest = WebRequest.Create(URL) as HttpWebRequest;
httpRequest.Method = "PUT";
using (Stream dataStream = httpRequest.GetRequestStream())
{
int bytesRead = 0;
while ((bytesRead = jpeg_image.Read(buffer, 0, buffer.Length)) > 0)
{
dataStream.Write(buffer, 0, bytesRead);
}
}
HttpWebResponse response = httpRequest.GetResponse() as HttpWebResponse;
}
I get hit with the following error from the console in my Blazor web page
blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Operation is not supported on this platform.
System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Net.WebProxy.CreateDefaultProxy () <0x366ff48 + 0x00008> in <filename unknown>:0
at System.Net.Configuration.DefaultProxySectionInternal.GetSystemWebProxy () <0x366fe28 + 0x00000> in <filename unknown>:0
at System.Net.Configuration.DefaultProxySectionInternal.GetDefaultProxy_UsingOldMonoCode () <0x366fd80 + 0x00000> in <filename unknown>:0
at System.Net.Configuration.DefaultProxySectionInternal.GetSection () <0x366fb80 + 0x0002a> in <filename unknown>:0
at System.Net.WebRequest.get_InternalDefaultWebProxy () <0x366f8c8 + 0x00034> in <filename unknown>:0
at System.Net.HttpWebRequest..ctor (System.Uri uri) <0x366d198 + 0x000b6> in <filename unknown>:0
at System.Net.HttpRequestCreator.Create (System.Uri uri) <0x366c7d8 + 0x00004> in <filename unknown>:0
at System.Net.WebRequest.Create (System.Uri requestUri, System.Boolean useUriBase) <0x366b498 + 0x00116> in <filename unknown>:0
at System.Net.WebRequest.Create (System.String requestUriString) <0x366b0e0 + 0x00024> in <filename unknown>:0
at ----.UploadPresigned.UploadObject (System.IO.Stream jpeg_image) [0x0000c] in C:\Users\----\Documents\----\----\DataForm.cs:78
at ----.Pages.DataUpload.HandleValidSubmit () [0x002b6] in C:\Users\----\Documents\----\----\Pages\DataUpload.razor:252
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion (System.Threading.Tasks.Task task) <0x36b85b0 + 0x000da> in <filename unknown>:0
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x30d7510 + 0x000b6> in <filename unknown>:0
For clarity, line 78 is the following line
HttpWebRequest httpRequest = WebRequest.Create(URL) as HttpWebRequest;
Note that I've put dashes in the stacktrace to preserve personal information.
I've previously been notified that multi-threaded things don't work will in Blazor (see comments to an answer in this question as well as this thread from GitHub so I'm hypothesising that the problem might be coming from the httpRequest having some multi-threaded backend, since the final two lines in the stack trace mention the System.Threading library.
This link here seems to have a similar issue, but I'm not sure how to port the fix to my code. I have included the project file below
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AWSSDK.Core" Version="3.5.3.8" />
<PackageReference Include="AWSSDK.S3" Version="3.5.9.7" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
<PackageReference Include="System.Net.Http.Json" Version="3.2.0" />
<PackageReference Include="BlazorInputFile" Version="0.2.0" />
</ItemGroup>
</Project>
Any advice on how to fix this error? Please let me know if I need to provide more information on how my app works.
I am beginner to development in sitecore using Helix Design Principle
i started with blank project and added one feature in feature layer and one layout in project layer as in this image and it works fine.
my issue when i tried to use asset module for styling purpose that exists in foundation layer of habitat to my project, it told me that it needs Dependency Injection and Sitecore Extension
and when i try to load DependenyInjection inside my project , and deploy it with gulpfile as in this image,the sitecore gave me that error
Server Error in '/' Application.
Could not load file or assembly 'Sitecore.JavaScriptServices.AppServices, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Sitecore.JavaScriptServices.AppServices, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Source Error:
Line 187: try
Line 188: {
Line 189: return assembly.GetExportedTypes();
Line 190: }
Line 191: catch (NotSupportedException)
Source File: D:\Ejada Files\NewsEjada - Copy - Copy\src\Foundation\DependencyInjection\code\ServiceCollectionExtensions.cs Line: 189
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Sitecore.JavaScriptServices.AppServices, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null' could not be loaded.
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'Sitecore.JavaScriptServices.AppServices, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.]
System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) +0
System.Reflection.RuntimeAssembly.GetExportedTypes() +32
Sitecore.Foundation.DependencyInjection.ServiceCollectionExtensions.GetExportedTypes(Assembly assembly) in D:\Ejada Files\NewsEjada - Copy - Copy\src\Foundation\DependencyInjection\code\ServiceCollectionExtensions.cs:189
[InvalidOperationException: Unable to load types from assembly Sitecore.XA.JSS.Foundation.Integration, Version=5.9.0.0, Culture=neutral, PublicKeyToken=null. Could not load file or assembly 'Sitecore.JavaScriptServices.AppServices, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.]
Sitecore.Foundation.DependencyInjection.ServiceCollectionExtensions.GetExportedTypes(Assembly assembly) in D:\Ejada Files\NewsEjada - Copy - Copy\src\Foundation\DependencyInjection\code\ServiceCollectionExtensions.cs:210
System.Linq.<SelectManyIterator>d__17`2.MoveNext() +265
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +287
System.Linq.WhereEnumerableIterator`1.MoveNext() +255
Sitecore.Foundation.DependencyInjection.ServiceCollectionExtensions.AddClassesWithServiceAttribute(IServiceCollection serviceCollection, Assembly[] assemblies) in D:\Ejada Files\NewsEjada - Copy - Copy\src\Foundation\DependencyInjection\code\ServiceCollectionExtensions.cs:39
Sitecore.Foundation.DependencyInjection.ServiceCollectionExtensions.AddClassesWithServiceAttribute(IServiceCollection serviceCollection, String[] assemblyFilters) in D:\Ejada Files\NewsEjada - Copy - Copy\src\Foundation\DependencyInjection\code\ServiceCollectionExtensions.cs:27
Sitecore.Foundation.DependencyInjection.Infrastructure.MvcControllerServicesConfigurator.Configure(IServiceCollection serviceCollection) in D:\Ejada Files\NewsEjada - Copy - Copy\src\Foundation\DependencyInjection\code\Infrastructure\MvcControllerServicesConfigurator.cs:12
Sitecore.DependencyInjection.BaseServicesConfiguratorFactory.Configure(IServiceCollection serviceCollection) +171
Sitecore.DependencyInjection.BaseServicesConfiguratorFactory.Configure(IServiceCollection serviceCollection) +171
Sitecore.DependencyInjection.BaseServiceProviderBuilder.ConfigureServiceCollection() +142
Sitecore.DependencyInjection.ServiceLocator.ConfigureServiceProvider() +225
Sitecore.DependencyInjection.ServiceLocator.get_ServiceProvider() +513
Sitecore.DependencyInjection.SitecorePerRequestScopeModule..ctor() +13
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +142
System.Activator.CreateInstance(Type type, Boolean nonPublic) +107
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1476
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +186
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +80
System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +234
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1153
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +139
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369
[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724
First, take a look at this sitecore community question as it feels similar to your case.
Then, if not fixed :
Make sure you have added the sitecore nuget source (https://sitecore.myget.org/F/sc-packages/api/v3/index.json) in your visual studio using nuget package manager -> Package Sources.
Add this source to your nuget.config within your solution as well.
Make sure you don't have any of those following dependencies already installed with some other reference within your project
<ItemGroup>
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.4" />
<PackageReference Include="Microsoft.AspNet.Razor" Version="3.2.4" />
<PackageReference Include="Microsoft.AspNet.WebPages" Version="3.2.4" />
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="1.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.1" />
<PackageReference Include="Microsoft.Net.Compilers" Version="1.3.2" />
<PackageReference Include="Microsoft.Web.Infrastructure" Version="1.0.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="System.ComponentModel" Version="4.0.1" />
<PackageReference Include="System.Diagnostics.Debug" Version="4.0.11" />
<PackageReference Include="System.Globalization" Version="4.0.11" />
<PackageReference Include="System.Linq" Version="4.1.0" />
<PackageReference Include="System.Linq.Expressions" Version="4.1.0" />
<PackageReference Include="System.Reflection" Version="4.1.0" />
<PackageReference Include="System.Resources.ResourceManager" Version="4.0.1" />
</ItemGroup>
From habitat project repos
If I use an Domain Name is works fine, but a I need use the ip address and not working. On WIFI the app also works as expected. The problem is with mobile data and the ip address.
I'm running app in IOS 10.3.1 and T-Mobile.
Here are the StackTrace of the error:
Instance {System.Net.WebException: Error: ConnectFailure (Network is unreachable) ---> System.Net.Sockets.SocketException: Network is unreachable
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in :0
at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x00000] in :0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult) [0x00000] in :0
at System.Net.HttpWebRequest.GetRequestStream () [0x00000] in :0
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in :0 } System.Net.WebException
I'm trying to get class from this wsdl
http://e-pelmex.com.br/services/soap?wsdl
But i get this error
nati pelmex # wsdl http://e-pelmex.com.br/services/soap?wsdl
Web Services Description Language Utility
Mono Framework v4.0.30319.17020
Error: Object reference not set to an instance of an object
Stack:
at System.Xml.Serialization.XmlSerializationReader.OnUnknownNode (System.Xml.XmlNode node, System.Object o, System.String qnames) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReader.UnknownNode (System.Object o, System.String qnames) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializationReader.UnknownNode (System.Object o) [0x00000] in <filename unknown>:0
at System.Web.Services.Description.ServiceDescriptionReaderBase.ReadObject_ServiceDescription (Boolean isNullable, Boolean checkType) [0x00000] in <filename unknown>:0
at System.Web.Services.Description.ServiceDescriptionReaderBase.ReadRoot_ServiceDescription () [0x00000] in <filename unknown>:0
at System.Web.Services.Description.ServiceDescription+ServiceDescriptionSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.XmlReader xmlReader) [0x00000] in <filename unknown>:0
at System.Web.Services.Description.ServiceDescription.Read (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0
at System.Web.Services.Discovery.DiscoveryClientProtocol.DiscoverAny (System.String url) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Web.Services.Discovery.DiscoveryClientProtocol:DiscoverAny (string)
at Mono.WebServices.Driver.Run (System.String[] args) [0x00000] in <filename unknown>:0
nati pelmex #
Any idea?
I'm calling a web service using client code that I generated using Microsoft's slsvcutil. No matter what call I make, I'm getting an EndpointNotFoundException. Stack trace is below. The service is running on my local machine. I'm able to successfully make identical calls from a MonoTouch application using the same generated client code and the same web service.
I'm running
Mono for Android 4.2.6
Monotouch 5.9.9.4
Mono 2.10.9
Anyone else seeing this?
System.ServiceModel.EndpointNotFoundException: A system exception has occurred. ---> System.Exception: Error: ConnectFailure (Network is unreachable) ---> System.Exception: Network is unreachable
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetRequestStream (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
at System.ServiceModel.Channels.HttpRequestChannel+<BeginProcessRequest>c__AnonStorey7.<>m__1 (IAsyncResult r) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.WaitEnd () [0x00000] in <filename unknown>:0
at System.ServiceModel.Channels.HttpRequestChannel.EndRequest (IAsyncResult result) [0x00000] in <filename unknown>:0
at System.ServiceModel.Channels.HttpRequestChannel.Request (System.ServiceModel.Channels.Message message, TimeSpan timeout) [0x00000] in <filename unknown>:0
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x00000] in <filename unknown>:0
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in <filename unknown>:0
at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in <filename unknown>:0
This appears to have been the result of a networking configuration.
The difference that seems to have allowed the MonoTouch application to work where Android did not was that I had the Android application running on a device (connecting to the web service over the network) where the MonoTouch application was running from a simulator on the same machine as the web service.