Quantcast
Channel: ASP.NET Core
Viewing all 9386 articles
Browse latest View live

Unable to restore nuget packages

$
0
0

I have a CentOS 7 server running the latest version of DNX. Upon uploading a small ASP.NET project (which runs fine on my local Windows machine), I attempted to run dotnet restore from a user with sudo privileges (and is an owner of the folder that the project is located in). 

I receive the following errors: 

Failed to create prime the NuGet cache. restore failed with: 1

error: Unable to obtain lock file access on '/tmp/NuGetScratch/lock/[random text] for operations on '/tmp/NuGet/TempCache/[guid]/fpsbidfe.tig'

The error message then suggests that removing the file stated above might allow NuGet to continue. However, when attempting to remove the file in question, I get a "file does not exist" error.

Any suggestions on what I can look into to figure out where the actual issue lies? Would removing all files in the/tmp/NuGetScratch/lock folder do any harm?


How to Pack / Reference "old" assemblies in 1.0 Tooling

$
0
0

I've heard that the tooling with ASP Core will change one more time (deprecating the project.json and so on)

Are there any informations about the planned way to reference "old" 4.* assemblies in core projects?

in RC 2 I wrapped them in nuget packages to a defined folder and made the folder accessible through global.json.

Is it likely that this will be a similar way in the 1.0 Tooling ? Or may be file references will be introduced again?

Any tessources pointing on an answer to this?

Can not compile after upgrading to .net Core 1.0

$
0
0

I installed Visual Studio 2015 Update 3 over my Update 2, i then uninstalled from programs and features the .net core rc2.  I then installed the installation package i downloaded from the release site "DotNetCore.1.0.0-VS2015Tools.Preview2.exe" (that's an odd name for a final release btw).  The strange part was a i was working for a half the day before issues started and I didn't change any configuration anywhere.  I can no longer compile a webforms or an MVC application in 2015.


Error The "ChecksumAlgorithm" parameter is not supported by the "Csc" task. Verify the parameter exists on the task, and it is a settable public instance property. TestApp.Tests 
Error The "Csc" task could not be initialized with its input parameters. TestApp.Tests

In Visual Studio 2013 it thinks all of my EF Entities are properties with errors like:

Error 558 'blah.blah.entityname' is a 'property' but is used like a 'type' c:\path\xyz..cs 90 9

Unable to uninstall RC2

$
0
0

I am enlisted in a project where I don't own the project files. I have updated from RC1 to RC2 but in the course of this found I could not load the XProj. So I wanted to uninstall RC2 and reinstall RC1. What I keep getting is an error when running the uninstall on RC2.

[2B44:2CD0][2016-06-09T12:59:53]i336: Acquiring container: WixAttachedContainer, copy from: C:\ProgramData\Package Cache\{22041006-8484-4b8d-a13c-40189695de2f}\DotNetCore.1.0.0.RC2-VS2015Tools.Preview1.exe
[2B44:2CE8][2016-06-09T12:59:53]e000: Error 0x80070001: Failed to extract all files from container, erf: 1:2:0
[2B44:2CD0][2016-06-09T12:59:53]e000: Error 0x80070001: Failed to wait for operation complete.
[2B44:2CD0][2016-06-09T12:59:53]e000: Error 0x80070001: Failed to open container.
[2B44:2CD0][2016-06-09T12:59:53]e000: Error 0x80070001: Failed to open container: WixAttachedContainer.
[2B44:2CD0][2016-06-09T12:59:53]e312: Failed to extract payloads from container: WixAttachedContainer to working path: C:\Users\dwolfe\AppData\Local\Temp\{D081681F-FC09-4886-BD31-B34A148342AA}\9E533866687847BA46211D2976C4A65B32A4B06E, error: 0x80070001.
[2B44:2C90][2016-06-09T12:59:53]e000: Error 0x80070001: Cache thread exited unexpectedly.
[2CA4:23A4][2016-06-09T12:59:53]i372: Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{22041006-8484-4b8d-a13c-40189695de2f}, resume: ARP, restart: None, disable resume: No
[2CA4:23A4][2016-06-09T12:59:53]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{22041006-8484-4b8d-a13c-40189695de2f}, resume: ARP, restart initiated: No, disable resume: No
[2B44:2C90][2016-06-09T12:59:53]i399: Apply complete, result: 0x80070001, restart: None, ba requested restart:  No

Is there a manual method to clean up this mess?

I'm totally blocked at the moment on my work. I have to manually point the uninstaller at the uninstall exe listed in the first line of this copy of this portion of the complete log. Yet this is not helping I keep getting this error. I've done a repair and then uninstall still get this same failure.

How to populate dropdown list from database? in asp.net core

$
0
0

Hello,

Someone has tutorial about: "How to populate dropdown list from database? in asp.net core"  @Html.DropDownList ?

All other tutorials from MVC 4 - 5 didn't work

AutoComplete => ComboBox / DropDownList - Any tutorial for latest ASP.NET Core rc2-3 ?

$
0
0

Hello,

Anyone have tutorial how to create "AutoComplete => ComboBox / DropDownList"  what will worked in latest version asp.net core ?

Tag Helpers Not Executing

$
0
0

I just moved some views into a new Core project and was converting my HtmlHelper tags to TagHelpers. They bind correctly but they are not doming any "work". E.g., they label asp-for doesn't pick up the DisplayName attributes and the validators don't fire. I'm guessing it has to do with a JavaScript thing sine the old page included some JavaScript using a @Script. I'm not sure where to start tarcking this down.

@model Card

@{
	ViewBag.Title = "Card Entry";
}<fieldset><legend>Pay Taxes By Credit Card</legend><br /><p>
		Please enter your credit card information here. You will not be charged yet.</p>

	Authorize = 4000100011112224<br /><form asp-route="Fund.Confirm"><hr /><div class="form-group"><label asp-for="CardNumber"></label><input asp-for="CardNumber" value="4000100011112224" /><br /><span asp-validation-for="CardNumber" /><br /><label asp-for="NameOnCard"></label><input asp-for="NameOnCard" value="Me" /><br /><span asp-validation-for="NameOnCard" /><br /><label asp-for="ExpireDate"></label><input asp-for="ExpireDate" value="0919" /><br /><span asp-validation-for="ExpireDate" /><br /><label asp-for="SecurityCode"></label><input asp-for="SecurityCode" value="321" /><br /><span asp-validation-for="SecurityCode" /><br /><input type="submit" value="Continue and Review" class="btn btn-default" /></div></form></fieldset>

Interface without Default Constructor Error

$
0
0

I'm passing an interface to a controller action

public IActionResult PrepareTransfer(IInstrument instrument) {

In my DI container I have

services.AddTransient<IInstrumentInstrument>();

Right now both IInstrument and Instrument are just empty, so the default constructor on Instrument should be available

public class Instrument : IInstrument{}
public interface IInstrument{}

When I run the app I get the following error:

ArgumentException: Type 'G3.Instruments.IInstrument' does not have a default constructor Parameter name: type


Exception occur on Registring a new User in .NetCoreApp v1.0.0

$
0
0

I want to Register a user in .Net Core Web application But all time This Exception occur. I search hundreds but nothing found useful.

<div class="titleerror">OverflowException: Arithmetic operation resulted in an overflow.</div>

System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)

<div class="titleerror">AggregateException: One or more errors occurred. (Arithmetic operation resulted in an overflow.)</div>

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

OverflowException: Arithmetic operation resulted in an overflow.

System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)

System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)

System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)

System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)

System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)

System.Data.SqlClient.SqlConnection.Open()

Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open()

Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerDatabaseCreator.Exists(Boolean retryOnNotExists)

Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.<Invoke>d__6.MoveNext()

Show raw exception details

AggregateException: One or more errors occurred. (Arithmetic operation resulted in an overflow.)

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Microsoft.AspNetCore.Identity.UserValidator`1.<ValidateUserName>d__6.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Microsoft.AspNetCore.Identity.UserValidator`1.<ValidateAsync>d__5.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Microsoft.AspNetCore.Identity.UserManager`1.<ValidateUserInternal>d__157.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

Microsoft.AspNetCore.Identity.UserManager`1.<CreateAsync>d__68.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

HttpContext.Session.GetString("string") I get a NullReferenceException

$
0
0

NullReferenceException

when it gets to this line:

 var stringId = context.Session.GetString("cart");

    public class Uno
    {
        private readonly HttpContext context;

        public Uno()
        {
        }

        public Uno(HttpContext _context)
        {
            context = _context;
        }
        public  string GetCartId()
        {
            string cartId = "";
            var stringId = context.Session.GetString("cart");
            if(stringId == null)
            {
                cartId = Guid.NewGuid().ToString();
                stringId = cartId;
            }
            else if(stringId != null)
            {
                cartId = stringId;
            }
            return cartId;
        }
    }

Reference to .NET Core Class Library project not working

$
0
0

Windows 10, Visual Studio 2015 Update 3

I have a .NET Core Class Library project, ClassLibrary1, set up to target both netstandard1.6 and net461. I have a second .NET 4.6.1 Console Application, ConsoleApplication1, from which I have created a project reference to ClassLibrary1. If I examine the properties of the ClassLibrary1 reference in the ColsoleApplication1 project I find the Path is as expected, i.e. pointing to ClassLibrary1.dll in the ClassLibrary1\bin\Debug\net461 folder. However, in ConsoleApplication1 code I cannot access anything from ClassLibrary1. It's as if I don't have a reference. If, on the other hand, I copy the ClassLibrary1.dll file from the location specified in Path to a temp location and then create a external reference directly to that file (instead of project reference) I suddenly have access to the contents of ClassLibrary1.

External (file) references are working but project references seem to be ignored.

Don't pass value from behind code to javascript after update page

$
0
0

hi,I have a google map in my page an get the Lat and Lng from database and pass them to javascrip to show map!

may map and dropdownlist are in update panel

when page load , everything is OK but when user select a text from dropdownlist to show new location on map,page dosn't show any map!

Thanks very much for any HELP:)

My aspx code:

<body><style>
        #map_canvas {
            width: 980px;
            height: 500px;
        }

        #current {
            padding-top: 25px;
        }
    </style><form id="form1" runat="server"><asp:HiddenField ID="ValueHiddenField" Value="" runat="server" /><asp:HiddenField ID="ValueHiddenField2" Value="" runat="server" /><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><div><section><asp:UpdatePanel runat="server" ID="upPanel"><ContentTemplate><div id='map_canvas'></div><asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
                            OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList></ContentTemplate></asp:UpdatePanel><div id="current">Nothing yet...</div><br /><br /></section></div></form><script src="jquery.min.js"></script><script src="../assets/js/jquery.js"></script><script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyChFoGoo_PYmtv5G4fbwPctWIZ2JENPEZ0&language=fa&region=IR&callback=initMap"></script><script>
        var GettingValue = document.getElementById('<%=ValueHiddenField.ClientID %>').value;
        var GettingValue2 = document.getElementById('<%=ValueHiddenField2.ClientID %>').value;
        var map = new google.maps.Map(document.getElementById('map_canvas'), {
            zoom: 14,
            center: new google.maps.LatLng(GettingValue, GettingValue2),
            mapTypeId: google.maps.MapTypeId.TERRAIN
        });

        var myMarker = new google.maps.Marker({
            position: new google.maps.LatLng(GettingValue, GettingValue2),
            draggable: true
        });

        google.maps.event.addListener(myMarker, 'dragend', function (evt) {
            document.getElementById('current').innerHTML = evt.latLng.lat().toFixed(3) + ',' + evt.latLng.lng().toFixed(3);
        });

        map.setCenter(myMarker.position);
        myMarker.setMap(map);

    </script></body>

and my behind code:

EvlaarEntities db = new EvlaarEntities();
        int id;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindDrpGrp();
                ValueHiddenField.Value = 38.0798351.ToString();
                ValueHiddenField2.Value = 46.2449312.ToString();
            }
        }
        void BindDrpGrp()
        {
            DropDownList1.DataTextField = "LocationName";
            DropDownList1.DataValueField = "idLocation";
            DropDownList1.DataSource = db.tbl_Locations.ToList();
            DropDownList1.DataBind();
            DropDownList1.Items.Insert(0, new ListItem("Select", "0"));
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            id = Convert.ToInt16(DropDownList1.SelectedItem.Value);
            tbl_Locations tbl = db.tbl_Locations.FirstOrDefault(i => i.idLocation == id);
            ValueHiddenField.Value = tbl.LocationLat;
            ValueHiddenField2.Value = tbl.LocationLng;
        }

 

VS.NET 2015 ENT Web Deploy ASP.NET Core 1 error ERROR_USER_UNAUTHORIZED?

$
0
0

Hello,

I have set a web deploy on a local Windows 2012 server with a new Site.

I have set permissions to Administrator at IIS server level and at the Site level thru IIS Manager Permissions.

I have created an Application Pool and a Virtual Directory for MySiteApp.

My Web Deploy publish settings at VS.NET 2015:

Server:         192.168.45.60
Site name:    TestSite/MySiteApp
User name:   TESTSERVER\Administrator

Validate Connection on publish profile pass ok.

Added <AllowUntrustedCertificate>True</AllowUntrustedCertificate> to  .pubxml

When trying to Publish to server I am receiving the error:

Error Error: The remote server returned an error: (401) Unauthorized.
Error Code: ERROR_USER_UNAUTHORIZED

At Windows Server 2012 event viewer I can see this error:

IISWMSVC_LOGIN_UNKNOWN_ERROR

An unexpected error occurred while retrieving the login information.

Exception:System.Runtime.InteropServices.COMException (0x8007000D): Invalid site name

at Microsoft.Web.Administration.Interop.IAppHostProperty.set_Value(Object value)
at Microsoft.Web.Administration.ConfigurationElementCollectionBase`1.FindElementWithCollectionKey(String elementName, String collectionKey, Object value)
at Microsoft.Web.Administration.SiteCollection.get_Item(String name)
at Microsoft.Web.Management.Server.ApplicationManagementUnit.EnsureDefinition()
at Microsoft.Web.Management.Server.ApplicationManagementUnit..ctor(IManagementContext context, String siteName, String applicationPath)
at Microsoft.Web.Management.Server.WebManagementHttpModule.CreateManagementUnit(HttpRequest request)
at Microsoft.Web.Management.Server.WebManagementHttpModule.OnApplicationPostAuthorizeRequest(Object sender, EventArgs e)

Process:WMSvc
User=TESTSERVER\Administrator

 

If I am changing at .pubxml as follows:

<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>  to  <MSDeployPublishMethod>RemoteAgent</MSDeployPublishMethod>

and add   <AuthType>NTLM</AuthType>

then I am able to publish with no problems.

    

I guess something I did not setup correctly for publishing with  WMSVC.

Thanks for any help.

Asaf

Web Server for ASP.NET CORE on Linux

$
0
0

Hi Guys, I am exploring running asp.net applications on linux. What options do I have for a web server? The tutorial I tried uses Kestrel. I would like to know if that is the only option I have or are there any other web servers that I can use. Also, would it be wise to use Kestrel for production applications?

Publish to Linux? (CentOS7)

$
0
0

Hi all,

I've followed the official documentation multiple times, and I still can't figure out how to actually run my ASP.NET Core project successfully. I'm a Linux dummy, so anything that might seem implicit isn't to me. 

I'm simply trying to host my REST API using nginx (web server).

Has anyone successfully published to CentOS7? Did you find any handy tutorials that helped you through the process?

Thanks in advance.


MVC, Core 1.0.0, Libraries, and SOAP

$
0
0

I'm trying to move to Core, but I'm running into a lot of problems that seem common. Since things (like names) have changed some much some of the answers I find no longer work. I'm looking for an example or good start to do the following.

I have an MVC application that uses a SOAP service. When I move to Core I can no longer use it directly. I create a new WCF project to wrap it, and with the https://blogs.msdn.microsoft.com/webdev/2016/06/26/wcf-connected-service-for-net-core-1-0-0-and-asp-net-core-1-0-0-is-now-available/

project I can now use it as a connected service. The problem is now that my types must be declared in two places. The service can't be the "master" so I can't declare them all as data contracts. So I think I will create a library to hold all of the types. But what kind and for what target? My WCF project wants a DLL and my MVC want Nuget. I tried many different approaches but none were working. I tried to create a library I could share, but I've tried several types (e.g., portable) with no luck. I thought I was getting close to an integration solution by creating wrappers and then Nuget for them, but I would end up getting errors about things being defined in assemblies that weren't referenced. This may sound confusing (it is), but if you've been here you know what I'm talking about. Solutions I've seen talk about which version the projects must target and adding dependencies in my json, but everything in the examples is outdated. I've been fighting this for days now.

My questions is, is there a CURRENT example out there that explains how to integrate WCF/SOAP, Class Library, and MVC projects in Core, that explains what project types, target frameworks, versions, etc. of everything you need to get these things to work together?

Referencing Classes in Core Project from WCF Service Project

$
0
0

I have a WCF service that acts on domain classes in my Core site. Since Core doesn't produce a dll I can't include a reference to them in my service project. I've resorted to declaring them in both projects, but that is a maintenance problem. The other option I can think of is a separate dll for just the shard classes that both would reference, but some of them are EF objects, so that becomes a problem too. Is there a way of referencing classes contained in a Core project from another project in the solution?

How to call a stored procedure from ASP.net core

$
0
0

I am looking to call a stored procedure from ASP.net core , so I am looking to pass a parameter in this stored procedure and then 

it gives back a string say  Hello Parameter.

I am looking to use ADO.net for this

Looking for hosting

$
0
0

Hi, I does anyone here knows a good hosting site? Azure is too pricey, my budget is about $5 per month. I know there a lots of webhosting out there, but im looking some reputable hosting and have asp.net core support. thanks

Bind my asp.net core app to all URLs

$
0
0
Hi,
how can I setup asp.net core web application to bind to all incoming requests?

Probably will be running it on kestrel behind IIS for now but later I might chage that.

What I need is all requests to my server no matter the domain name direct to my asp.net core.

Is there something like wildcard "*" when specifiing the kestrel urls binding? Or how to accomplish this?

Thanks.
Viewing all 9386 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>