Menu
  • HOME
  • TAGS

Windows Azure role recycles continuously with Microsoft-Windows-WAS Warnings

Tag: asp.net-mvc,debugging,iis,azure,azure-web-roles

I know this is probably one of the most common Windows Azure deployment questions, but it's been troubling me for three to four days now and I can't seem to find the root of the cause. The cloud service deployment constantly restarts and recycles itself.

When I remote into the VM, I only see two Warnings (with Source "Microsoft-Windows-WAS") in the IIS Manager:

[ID: 5048] The application '/' belonging to site '1' has an invalid AppPoolId 'DefaultAppPool' set. Therefore, the application will be ignored.

This is followed by:

[ID: 5056] Site 1 was disabled because the root application defined for the site is invalid. See the previous event log message for information about why the root application is invalid.

I've tried IntelliTrace but nothing helpful nor conclusive can be obtained in the short time that the web role is alive; under the Sites folder in IIS Manager there is nothing to be found. This is baffling me; I thought it was an SDK dependency mismatch so I went ahead to uninstall everything save for Windows Azure SDK 2.1, but the problem persists.

Debugging in the full compute emulator seems to return no issue, however.

Hope someone around here can help me out here... I'm desperate!!

Best How To :

My issue was that I did not have anything in one my specified VirtualDirectorys, hence when it was packaged/published the physical folder was not created. As a result when the instance was initializing it could not find the physical folder for this VirtualDirectory mapping. Hence the error:

Exception:System.IO.DirectoryNotFoundException: E:\sitesroot\1

My advice to anyone facing this issue is: always take a look at your Event Viewer and spend a couple of moments thinking of what could be the cause of the error... cheers!

How to store a string in xml file and use it in _Layout in MVC

c#,xml,asp.net-mvc,asp.net-mvc-4

Sourced: from this link The web.config (or app.config) is a great place to store custom strings: in web.config: <appSettings> <add key="message" value="Hello, World!" /> </appSettings> in cs: string str = ConfigurationSettings.AppSettings["message"].toString(); ...

How to add validators for @Html.TextBox() without model

asp.net-mvc,asp.net-mvc-4

Add data-val and data-val-required attribute for Html.TextBox() as shown below. <script src="~/Scripts/jquery-1.10.2.min.js"></script> <script src="~/Scripts/jquery.validate.min.js"></script> <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script> @using (Html.BeginForm("","")) { @Html.ValidationSummary() @Html.TextBox("bill_address", null, new { @class = "form-control valid", @data_val = "true", @data_val_required = "Billing Address is required" }) <input type="submit" value="Click"...

How to hide columns in Kendo Grid when editing in a popup

asp.net-mvc,kendo-ui,kendo-grid,kendo-asp.net-mvc

You can use the edit event of the grid to hide some element from the popup window: $("#grid").kendoGrid({ edit: function(e) { e.container.find(".k-edit-label:first").hide(); e.container.find(".k-edit-field:first").hide(); } }); ...

How to Convert a Time to local Time in Different TimeZone

c#,asp.net,asp.net-mvc,timezone,timezoneoffset

The main problem I see with your code is the first line in your TimeAgo() method: The DateTime dt object you pass to this method is local time for your clients, but then you use the server local time DateTime.Now to calculate the timespan. Pass the UTC timestamps you get...

Http Get Request for IpDBInfo using an IP Address

c#,asp.net-mvc,geolocation,ip

The response of IPInfoDB is a string like below: OK;;74.125.45.100;US;United States;California;Mountain View;94043;37.406;-122.079;-07:00 So we need to split into the various fields using C# codes below. string key = "Your API key"; string ip = "IP address to check"; string url = "http://api.ipinfodb.com/v3/ip-city/?key=" + key + "&ip=" + ip; HttpWebRequest webReq...

Adding where clause to IEnumerable Select

c#,asp.net-mvc,linq

Per Discosultan in the comments: IEnumerable<int> interestIds = viewModel.ExistingInterests.Where(x => x.selected == true).Select(x => x.InterestId); ...

When adding a user to a role in asp.net mvc 4.5, i'm getting an error- “user (user name) not found”

c#,asp.net-mvc

The problem is you are not setting roleManager properly in webconfig. change your webconfig as below. <roleManager enabled="true" cacheRolesInCookie="true" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All" defaultProvider="AspNetSqlRoleProvider" createPersistentCookie="false" maxCachedResults="25" /> ...

File IO Close() method error in ASP.NET MVC 6

asp.net-mvc,asp.net-mvc-6

Do you use the core CLR? The StreamWriter.Close method are not available in core CLR. You can use Dispose method replace. You also can use using statement: using (var writer = System.IO.File.CreateText("your_path")) { writer.WriteLine("text"); } ...

ASP.NET MVC Client side time convert from model

javascript,asp.net-mvc,model

I don't think you can achieve this without using JavaScript. Here's something you could try (using jQuery for convenience): foreach (var item in Model) { <tr> <td data-iso="@item.someDate.ToString("o")"></td> </tr> } Afterwards, in document.ready just parse the date and set the locale in the td: $("document").ready(function () { $("td").each(function (index, elem)...

Angularjs resource with scope parameter

javascript,asp.net-mvc,angularjs,single-page-application

If this is an AJAX call then the varialble initialization should be into the callback methods: Fakturi.fakturi.get({ id: $routeParams.id }, function (data) { $scope.faktura = data; }); Fakturi.komintenti.get({ id: $scope.faktura.KomintentID }, function (data) { $scope.komintent = data; }); According to this link, if you would like to get response immediately...

How to map between two entities before paging

c#,asp.net-mvc,entity-framework

You just want to make sure you don't pull anymore records out of the database than you need. As you can't use your ProviderViewModel constructor in LINQ to Entities you will have to retrieve the requested page yourself before creating your view model objects: public ActionResult Index(int? page) { List<ProviderViewModel>...

How to get started with Visual studio 2012

c#,asp.net-mvc,asp.net-mvc-3,asp.net-mvc-4,visual-studio-2012

Download this book "Microsoft ASP.NET 4 Step By Step" by George Shepherd.I found it very helpful.It will address all the issues you raised here.Thank you.

check if file is image

c#,asp.net,asp.net-mvc

You can't do this: string.Contains(string array) Instead you have to rewrite that line of code to this: if (file == null || formats.Any(f => file.Contains(f))) And this can be shortened down to: if (file == null || formats.Any(file.Contains)) ...

Unable to find the auto created Database

c#,asp.net,asp.net-mvc,entity-framework

If you don't specify a database name then the connection will use the default database for the user, in this case it's integrated security so it's your Windows login. As you likely have full system admin on the server the default database will be master so you will find all...

Multiple Posted Types asp.net 5 MVC 6 API

c#,asp.net,asp.net-mvc,asp.net-5,asp.net-mvc-6

The best way is to create a composite wrapper: public class Wrapper { public ModelA A { get; set; } public ModelB B { get; set; } } Put Wrapper in the parameter list and mark that [FromBody]. You can't use that attribute more than once because all of the...

How to use ajax to post json string to controller method?

jquery,asp.net-mvc,visual-studio-2013,asp.net-mvc-5

Your action method is expecting a string. Create a javascript object, give it the property "data" and stringify your data object to send along. Updated code: $.ajax({ type: 'post', dataType: 'json', url: 'approot\Test', data: { "json": JSON.stringify(data) }, success: function (json) { if (json) { alert('ok'); } else { alert('failed');...

Perl Debugging Using Flags

perl,debugging,script-debugging

In perl, compile time is also run time. So there's really not a great deal of advantage in using #define type statements. My usual trick is: my $debug = 0; $debug += scalar grep ( "-d", @ARGV ); (GetOpt is probably honestly a better plan though) And then use: print...

ASP.NET httpHandlers & handlers

asp.net,asp.net-mvc

The system.webServer section in the Web.config file specifies settings for IIS 7.0 that are applied to the Web application. The system.WebServer is a child of the configuration section. For more information, see IIS 7.0: system.webServer Section Group (IIS Settings Schema). and <system.web> specifies the root element for the ASP.NET configuration...

which approach is best for GET,POST using Rest API [closed]

c#,jquery,asp.net-mvc,angularjs

There is no 'best' way to do this, but I'd suggest implementing your RESTful API using ASP.NET Web API and then consuming that with AngularJS on the front-end (using the $http service). It's a pretty neat way of communicating with your APIs without having to navigate away from the page,...

MVC route attribute no controller

asp.net-mvc,asp.net-mvc-5,asp.net-mvc-routing

Ok so ranquild's comment pushed me in the right direction. In my route config, I had the default route of routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); So that my homepage would still work on the url with...

Can somebody explain why this is the result? [on hold]

java,debugging

because of } else if (c >= '0' || c <= '9'){ you probably want it to be } else if (c >= '0' && c <= '9'){ ...

HTTP Error 403.14

asp.net-mvc,visual-studio-2013

Stilly! There is a refactor bug in VS that changes the routes as well! My default route was changed to the following and I had to rename name to id and everything is working fine! routes.MapRoute( name: "Default", url: "{controller}/{action}/{name}", defaults: new { controller = "Home", action = "Index", id...

Strange situation, Visual Studio debugging ran through action to view but nothing returned to browser

c#,jquery,ajax,asp.net-mvc,razor

error: function () { alert("EmptyResult returns."); debugger; $.post('@Url.Action("Delete2", "Customers")', { id: clickedId }); }, Result of a post does not refresh your page, so quick fix is to genrate an anchor with URL to controller action add id parameter and click on it or change window location with controller/action/clicked id....

Getting 302 response headers from Ajax.BeginForm?

c#,jquery,asp.net,ajax,asp.net-mvc

There is no way to make JavaScript AJAX queries to not follow redirects. (See How to prevent ajax requests to follow redirects using jQuery for more discussion). You should consider other options - i.e. returning JSON with "redirect location" would be more AJAX-friendly. return new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet,...

Creating a viewmodel on an existing project

c#,asp.net,asp.net-mvc

You are using a namespace, your full type name is Project.ViewModel.ViewModel (namespace is Project.ViewModel and class name is ViewModel) so use this using instead: @model Project.ViewModel.ViewModel ...

How to use Autofac to inject specific implementation in constructor

c#,asp.net-mvc,dependency-injection,autofac

Autofac is nicely documented and it looks like you can find what you are after here. From what I can tell, if you have registered your updators with builder.RegisterType<LastActivityUpdator>(); builder.RegisterType<AnonymousUserLastActivityUpdator>(); then you should be able to register your services with builder.Register(c => new UserService(c.Resolve<LastActivityUpdator>())); builder.Register(c => new AnonymousUserService(c.Resolve<AnonymousUserLastActivityUpdator>())); or...

.NET MVC: Finding default Bootsrap JavaScripts

javascript,asp.net-mvc,twitter-bootstrap

You can reference the open li using css class selector '.': $(".dropdown.open") this will give you the currently open dropdown. Explanation: 'CSS selectors' allow you to select elements using CSS syntax. For example: '#id' where the '#' indicates the following text is the id of the element. '.class' allows you...

Database object with different data

sql,asp.net,asp.net-mvc,database,entity-framework-6

Ideally what you want is a many-to-many relationship between your Shop and Product entities: public class Shop { public int ShopId {get; set;} public virtual ICollection<ShopProduct> ShopProducts {get; set;} } public class Product { public int ProductId {get; set;} public string Name {get; set;} public virtual ICollection<ShopProduct> ShopProducts {get; set;}...

MVC 5 OWIN login with claims and AntiforgeryToken. Do I miss a ClaimsIdentity provider?

asp.net-mvc,asp.net-mvc-4,razor,asp.net-mvc-5,claims-based-identity

Your claim identity does not have ClaimTypes.NameIdentifier, you should add more into claim array: var claims = new List<Claim> { new Claim(ClaimTypes.Name, "Brock"), new Claim(ClaimTypes.Email, "[email protected]"), new Claim(ClaimTypes.NameIdentifier, "userId"), //should be userid }; To map the information to Claim for more corrective: ClaimTypes.Name => map to username ClaimTypes.NameIdentifier => map...

Output Raw String in ASP.NET MVC Razor [duplicate]

c#,asp.net-mvc,razor

You can use Html.Raw to output the unencoded data: <input id='myHiddenInput' type='hidden' value='@Html.Raw(ViewBag.Text)' /> Here is a link to dotnetfiddle. You can see the output in text field, but there is also a hidden field with the same unencoded information....

ASP.NET EF6 - 2 Tables & 1 Link Table

c#,sql-server,asp.net-mvc,entity-framework

If you are looking to add an employee and their contact info on the same form, then you should use a View Model. Your View Model will be an amalgamation of the properties you need on both the Employee and Contact into one class. You will then implement your Employee...

Url.Action Compilation Error : BC30988: Type or 'With' expected

javascript,c#,html,asp.net-mvc

Why are you doing it that way,you can sort it by using Url.Action() and concatenating query string parameters this way: function patrListClick(PAT_ID) { window.location.href = '<%: Url.Action("PatrList", "Patr") %>?id='+PAT_ID; } ...

How to get Display Text from EnumDropDownListFor on post?

c#,asp.net-mvc,enums,html-helper

You can write an extension method for Enums to return Display value of an Enum value: public static class DataAnnotationHelpers { public static string GetDisplayValue(this Enum instance) { var fieldInfo = instance.GetType().GetMember(instance.ToString()).Single(); var descriptionAttributes = fieldInfo.GetCustomAttributes(typeof(DisplayAttribute), false) as DisplayAttribute[]; if (descriptionAttributes == null) return instance.ToString(); return (descriptionAttributes.Length > 0) ?...

Show/hide tinymce with radio buttons

c#,asp.net,asp.net-mvc,tinymce

Your missing an @symbol for the id attribute: Modify your script as well like this: ***EDIT some thing seems off about the radio buttons only one should be checked and they should have the same name ** you can use the # to denote and ID in Jquery by the...

MVC5 - How to get results that span multiple entities

asp.net-mvc

It will count items in your navigation property: var Quantity=db.Jobs.Items.Count(); This means items per job...

Checkbox to be checked on having value Y

asp.net-mvc,knockout.js

Use a computed writable observable: var ViewModel = function() { var self = this; self.actualObservable = ko.observable('Y'); self.relatedObservable = ko.computed({ read: function() { return self.actualObservable() === 'Y'; }, write: function(x) { self.actualObservable(!!x ? 'Y' : 'N'); } }); }; ko.applyBindings(new ViewModel()); <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script> <input type="checkbox" data-bind="checked: relatedObservable"> = Checked<br />...

Why is my View not displaying value of ViewBag?

c#,asp.net,asp.net-mvc,asp.net-mvc-4,razor

ViewBag is used when returning a view, not when redirecting to another action. Basically it doesn't persist across separate requests. Try using TempData instead: TempData["Tag"] = post.SelectedTag.ToString(); and in the view: <p><strong>Tag: @TempData["Tag"]</strong></p> ...

Best approach to upgrade MVC3 web app to MVC5?

c#,.net,asp.net-mvc,asp.net-mvc-5

There's a handy documented guide by Rick Anderson which he wrote to upgrade from MVC4, the same applies to you with the exception of the fact that the "Old version" of DLLs he mentions will be different to the ones that you will have, but the outcome will still be...

System.net.http.formatting causing issues with Newtonsoft.json

c#,asp.net,asp.net-mvc,json.net

Does the assemblyBinding tag have proper xmlns schema? Check if the issue you are encountering is same as Assembly binding redirect does not work

How to format label in ASP.net chart control

c#,asp.net,asp.net-mvc,c#-4.0,reporting-services

Use formatting: DateTime.Now.ToString("dddd, dd-MM-yy"); Output: Montag, 15-06-15 //Written day of week in your local culture. To edit the axis labeling, you can do it in your code-behind file: Chart1.ChartAreas[0].AxisX.LabelStyle.Format = "dddd, dd-MM-yy"; Or in your markup: <ChartAreas> <asp:ChartArea Name="ChartArea1"> <AxisX Title="Date" IsLabelAutoFit="True" TitleForeColor="#ff0000"> <LabelStyle Format="dddd, dd-MM-yy" /> <MajorGrid Enabled ="False"...

ASP.NET MVC posting list from view to controller

c#,.net,asp.net-mvc,razor

That's probably a good candidate for an EditorTemplate to be honest, that way you don't have any issues with prefixing: @Html.EditorFor(m => m.TechnologyFilters) Without using an editor template though, a technique you can use is to specify the prefix in your partial declaration within the ViewDataDictionary, by doing: Html.RenderPartial("_TechnologyFilters", Model.TechnologyFilters,...

Can I check if action is a child action in a view?

c#,asp.net-mvc,razor

You can use ViewContext.IsChildAction in view.

Knockout JS Validation not working

javascript,asp.net-mvc,knockout.js

At this line var EmployeeKoViewModel.errors = ko.validation.group(self); you are trying to create a variable, but the syntax is like creating an object with a property which is of course invalid. In order to fix this you can initialize your object first: var EmployeeKoViewModel = {}; EmployeeKoViewModel.errors = ko.validation.group(self); if (!EmployeeKoViewModel.errors().length...

devenv.exe hogs CPU when debugging

asp.net-mvc,visual-studio-2013

I didn't manage to find the source of the problem, but closing all editor windows in VS seems to make it go away. If there are further lag spikes, restarting debugging might be also a good idea. Since I didn't see this problem in a new project, it might be...

Install Android app on device through wifi - no usb or emulator

android,debugging,android-emulator,usb,wifi

If you are using Cyanogenmod, developer options provides a way to operate adb over network. 1) Enable 'ADB over network' in Developer option of Android Settings 2) When you enable 'ADB over network' and if you are connected to internet, you will find your wlan device ip address below the...

Rails 4 + delayed job - constantly writing debug code to production logs

ruby-on-rails,debugging,delayed-job

It is normal, you must have set log_level in config/environments/production.rb to :debug. Changing it to :info will not update production log with delayed job's debug comments....

How to enable multiple login tries in asp.net forms authentication?

c#,asp.net,asp.net-mvc,authentication

It's because of your ViewBag's returnUrl sets null after postback, just simply put ViewBag.ReturnUrl = returnUrl; at the beginning of your HttpPost verb of Login action. ...

ViewData Compilation Error : BC30203: Identifier expected

javascript,c#,jquery,html,asp.net-mvc

Add below line to top of the view page, then it works perfect. <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %> ...

Dynamically adding controls in MVC4

asp.net-mvc,asp.net-mvc-4

You can create a editor template and pass the control list as model to the template and in the template you can iterate that list to generate the control. As i have shown below. 1->Create a class for Control Information. public class ControlInfo { public string ControlType { get; set;...

Avoid EF update the null image to database in .Net MVC

asp.net-mvc,entity-framework,null,edit,httppostedfilebase

Mark Image property as not modified: db.Entry(sach).State = EntityState.Modified; if (image == null) db.Entry(sach).Property(m => m.Image).IsModified = false; db.SaveChanges(); ...