Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all 3509 articles
Browse latest View live

ASP.NET 4.0 and targetFramework?

$
0
0

Hello

When creating a new vb.net project in Visual Studio 2017, how do I ensure that it is geared to ASP.NET 4.0 and not 4.5.2. What would I expect to see under target framework in the Web.config file, please?

Thank you.


textbox width constrained VS2017 default web side

$
0
0

Hi

I have created the default web site from the menu of VS2017 using file - new - web site.

On the default.aspx web page, I want to place a text box that will span 100% of the web page.  But, the best width I can get is about 25% of the web page in a browser.  I have removed all the code provided within the content tag and have only a textbox.  Here is the code.  This is the only change from the default web site.

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

                <asp:TextBox ID="TextBox3" runat="server"

                    width="100%">

                </asp:TextBox>

</asp:Content>

Any suggestions?  Thanks for any help.

How to copy DLLs?

$
0
0

Hello

From what I can gather, the server of my Web hosting service is missing certain DLLs and that is why I am getting the error: The file '/Frina/Contact.aspx' has not been pre-compiled, and cannot be requested.

I do not know what those missing DLLs are or where to find them! Any advice, please?

On another note, my Web.config looks like this (do I need all of that assembly code, parameters, entity Framework, etc?). This is a simple site with a contact form and that's it: no log-ins required, no database, etc.

<?xml version="1.0" encoding="utf-8"?><!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  --><configuration><configSections><!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --><section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /></configSections><connectionStrings><add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=aspnet-Home-Flix-20171207133658;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-Home-Flix-20171207133658.mdf" /></connectionStrings><system.web><compilation debug="false" strict="false" explicit="true" targetFramework="4.0" /><customErrors mode="Off"/></system.web><system.webServer><modules runAllManagedModulesForAllRequests="true" /></system.webServer><runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" /><bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" /></dependentAssembly><dependentAssembly><assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" /><bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" /></dependentAssembly></assemblyBinding></runtime><entityFramework><defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"><parameters><parameter value="mssqllocaldb" /></parameters></defaultConnectionFactory><providers><provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /></providers></entityFramework></configuration>

Option Strict issue

$
0
0

Since last week's update of my Visual Studio all my projects are coming up with errors such as "Option Strict On requires that all method parameters have an 'As' clause" despite the project having theOption Strict "Off". It's happening on all my projects now. The only way around I found is to go in Compile change the "Option Strict" to On, save the project, and change the "Option Strict" to Off and save the project. This appears to solve the issue. 

But anyway I am wondering if I should always be working with the "Option Strict" to On. What are your thoughts ? 

changes are not allowed if the project wasn't built when debugging started

$
0
0

I have googled this and found lots of suggestions on what to do, but none of them work.

This was working just fine last week.  The only thing I've installed in the last week was SSMS 2016.

If anyone who has ideas on how to get passed this, I would appreciate it!

CLR profiling: DoStackSnapshot returns wrong Instruction Pointer

$
0
0

'm currently writing a CLR profiler, and I came across something very odd. When throwing two different exceptions, one from the try clause and one from the catch clause, the CLR notifies me of the same instruction pointer.

I'm registered to receive the ExceptionThrown callback
While inside that callback, I start a DoStackSnapshot on the current thread.

HRESULT stackSnapshotCallback(FunctionID funcId, UINT_PTR ip, COR_PRF_FRAME_INFO, ULONG32, BYTE context[], void *clientData)

(https://docs.microsoft.com/en-us/dotnet/framework/unmanaged-api/profiling/icorprofilerinfo2-dostacksnapshot-method)

I have an exception thrown from a try clause and the corresponding catch clause. StackSnapshotCallback returns the SAME ip for both (UINT_PTR ip)

c# code that reproduces the issue

try
{
    try
    {
        throw new Exception("A");
    }
    catch (Exception)
    {
        throw new Exception("B");
    }
}
catch (Exception)
{
}

I'll also mention that this is not a case of a rethrow, when this is expected.

Application Insights Not Running In Local Mode

$
0
0

Hi,

While following the beginners' course on MVA I came to know about Application Insights being available for running in local mode. Upon adding the same to my sample project I was surprised to find the activity to be showing 0's (zeros)?

  1. I right clicked the project
  2. Selected Add > Application Insights Telemetry
  3. Upon Application Insights Configuration Page selected Start Free
  4. On the proceeding page I selected the option Or just add SDK to try local only mode at the bottom of page
  5. Ran the application by pressing IIS Express
  6. The Application Insights button I had added on the toolbar didn't show any number of activity
  7. Upon clicking the said button the Application Insights Search page appeared, but with every event/result as 0 (Zero)

While the Immediate Window showing Application Insights Telemetry (unconfigured) at some places.

The Startup file is as:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;

namespace FAQ
{
    public class Startup
    {
        public Startup(IConfiguration config)
        {
            configuration = config;
        }

        public IConfiguration configuration { get; }

        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext<FAQ_TempDB>(options => options.UseInMemoryDatabase("Some_Name"));
            services.AddLogging();
            services.AddMvc();
        }

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole();
            loggerFactory.AddDebug();
            app.UseDeveloperExceptionPage();
            app.UseBrowserLink();
            app.UseStaticFiles();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
    }
}

while I have used it on the Create Model in a single CRUD page model as:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using FAQ.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;

namespace FAQ.Pages
{
    public class CreateModel : PageModel
    {
        private readonly FAQ_TempDB _TempDB;

        private ILogger<CreateModel> Log;

        public CreateModel(FAQ_TempDB tempDB, ILogger<CreateModel> log)
        {
            _TempDB = tempDB;
            Log = log;
        }

        [TempData]
        public string xMessage { get; set; }

        [BindProperty]
        public Worker Worker { get; set; }

        public async Task<IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid) {return Page();}

            _TempDB.Workers.Add(Worker);
            await _TempDB.SaveChangesAsync();
            var xMsg = $"Record of {Worker.W_FName} added!";
            xMessage = xMsg;
            Log.LogCritical(xMsg); //LOG ACTIVITY NOT WORKING ON APP INSIGHTS
            return RedirectToPage("/BackToDB");
        }
    }

    public class BackToDBModel : PageModel
    {
        private readonly FAQ_TempDB _TempDB;

        public BackToDBModel(FAQ_TempDB tempDB)
        {
            _TempDB = tempDB;
        }

        public IList<Worker> Workers { get; private set; }

        [TempData]
        public string xMessage { get; set; } //Name should be same as one declared in Create Model

        public async Task OnGetAsync()
        {
            Workers = await _TempDB.Workers.AsNoTracking().ToListAsync();
        }

        public async Task<IActionResult> OnPostDeleteAsync(int id)
        {
            var worker = await _TempDB.Workers.FindAsync(id);
            if (worker != null)
            {
                _TempDB.Workers.Remove(worker);
                await _TempDB.SaveChangesAsync();
            }
            return RedirectToPage();
        }
    }

    public class EditModel : PageModel
    {
        private readonly FAQ_TempDB _TempDB;

        public EditModel(FAQ_TempDB tempDB)
        {
            _TempDB = tempDB;
        }

        [BindProperty]
        public Worker Worker { get; set; }

        public async Task<IActionResult> OnGetAsync(int id)
        {
            Worker = await _TempDB.Workers.FindAsync(id);
            if (Worker == null)
            {
                return RedirectToPage("/BackToDB");
            }
            return Page();
        }

        public async Task<IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return Page();
            }

            _TempDB.Attach(Worker).State = EntityState.Modified;

            try
            {
                await _TempDB.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                throw new Exception($"Worker {Worker.W_FName} Not Found!", ex);
            }
            return RedirectToPage("/BackToDB");
        }
    }
}

The app works well on console reflecting the requisite critical portion in red but I don't understand why not on the local mode of Application Insights? Is it necessary to use Azure?

Please see if any of you experts can help.

Thanks

xamarin installation ends with problems

$
0
0

Hello guys

I am trying to modify VS and add xamarin to my installation, however at 25% it keeps stopping and telling me that it cant download this link

https://go.microsoft.com/fwlink/?LinkID=842899

when I click on it, it takes me to oracle's website at this link

http://download.oracle.com/errors/download-fail-1505220.html

upon completion it says Couldn't downloadpackage JavaJDKV2

kindly advise

Ehi

<div id="banner" style="list-style: none; color: #000000; font-family: arial, helvetica, sans-serif; font-size: 12px;">
<div id="bannerMid" style="list-style: none;"></div>
</div>

Sorry!

In order to download products from Oracle Technology Network you must agree to the OTN license terms.
Be sure that...
 Your browser has "cookies" and JavaScript enabled.
 You clicked on "Accept License" for the product you wish to download.
 You attempt the download within 30 minutes of accepting the license.
From here you can go...
Back to Previous Page
Site Map
OTN Homepage

Problems Accessing Report Veiwer (.rdlc) Website Data Sources

$
0
0

 Previously had this setup in VS2005, and everything worked fine, I could load a report and drag and drop the columns into the appropriate places, have in the last month updated the project to use VS2008, now I cannot see the "website data sources" pane. When I try to access this using the Reports>Data Sources option it blows an "Aspose.Network assembly could not be found or does not exist", this is referenced by the project and is not used at all in any of the report viewer functions that I know of (have seen code to add erxtra functionality).

Does anyone know how to get this to work?

npm install typescript not working

$
0
0

Currently my version of Visual Studio is using version 2.3 of typescript..

This was installed with the Visual Studio installation.

I have a requirement to test typescript latest version (2.5) using npm to install it.

However on attempting to install this version via npm i am having no success, i get this error in the log file....

12 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "typescript"
13 verbose node v9.3.0
14 verbose npm v5.5.1
15 error code EACCES
16 error errno EACCES
17 error FetchError: request to https://registry.npmjs.org/typescript failed, reason: connect EACCES 151.101.16.162:443
17 error at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\index.js:68:14)
17 error at ClientRequest.emit (events.js:159:13)
17 error at TLSSocket.socketErrorListener (_http_client.js:389:9)
17 error at TLSSocket.emit (events.js:159:13)
17 error at emitErrorNT (internal/streams/destroy.js:64:8)
17 error at process._tickCallback (internal/process/next_tick.js:152:19)
17 error { FetchError: request to https://registry.npmjs.org/typescript failed, reason: connect EACCES 151.101.16.162:443
17 error at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\index.js:68:14)
17 error at ClientRequest.emit (events.js:159:13)
17 error at TLSSocket.socketErrorListener (_http_client.js:389:9)
17 error at TLSSocket.emit (events.js:159:13)
17 error at emitErrorNT (internal/streams/destroy.js:64:8)
17 error at process._tickCallback (internal/process/next_tick.js:152:19)
17 error message: 'request to https://registry.npmjs.org/typescript failed, reason: connect EACCES 151.101.16.162:443',
17 error type: 'system',
17 error errno: 'EACCES',
17 error code: 'EACCES',
17 error stack: 'FetchError: request to https://registry.npmjs.org/typescript failed, reason: connect EACCES 151.101.16.162:443\n at ClientRequest.req.on.err (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\pacote\\node_modules\\make-fetch-happen\\node_modules\\node-fetch-npm\\src\\index.js:68:14)\n at ClientRequest.emit (events.js:159:13)\n at TLSSocket.socketErrorListener (_http_client.js:389:9)\n at TLSSocket.emit (events.js:159:13)\n at emitErrorNT (internal/streams/destroy.js:64:8)\n at process._tickCallback (internal/process/next_tick.js:152:19)' }
18 error Please try running this command again as root/Administrator.

Anyone know what the issue is?

convert lines of text to

$
0
0

Is there an easy method to convert  lines if text to an  ordered / unorderd list ?

line1
line2
line2

<ul>
       <li>line1</li>
       <li>line2</li>
       <li>line3</li>
</ul>

Thanks

Visual Studio 2017 Community - Creating Website

$
0
0

Hello All,

When I create a website in Visual Studio 2017 Community (File > Create Website) two folders are created for the Solution.

Both folders have the same name, but the second folder is followed by a (2).

Example:  If I create a Solution Called "Cat" the following folders are created:  Cat and Cat(2).

The first folder contains the development files (.cshtml, etc) and the second folder contains the .sln file and a "packages" folder.

My website is in C#, and I am using the Razor View Engine.

Questions:

1.  Is there any way to have all the files create in a single folder.

2.  I am using GitHub (I am very new to GitHub), and it appears I can only put one folder per solution under source control.  This poses a problem as each of my Solutions has two folders.

Any guidance appreciated.

Many thanks in advance...

How do I precompile Web Applicatiob Project updated page

$
0
0

Hello,

I have a site in WAP hosted in winhost server, the site has many page, but each time I modify the code-behind of a single page using Visual Studio the whole existing file in the remote directory will have to be deleted and replaced with new ones when I publish it.

I do not want it that way.
How do I compile just the single affected page and upload that alone?

Debug .net core 2.0 app fails with error "invalid uri: the hostname could not be parsed."

$
0
0

Hi,

when trying to lauch the Debugger from within VS 2017 I get suddenly an error box saying "Invalid uri: the hostname could not be parsed."

It is a .Net Core 2.0 ASP.NET-Application, Profile/Launch IISExpress.

Please help, I have no clue where to start to resolve that problem.

TIA

Michael

Cannot View default.aspx in Design Mode

$
0
0

I can only view source.  I cannot view the design mode.  I am running Windows 2000.  Any ideas?

 

Thaks


How do I use VS2017 to backup database to an older version of SQL server?

$
0
0

I am attempting to build and remotely host the standard VS2017 ASP.Net web forms template as a starter to developing it further for my own application.

I have built the application and deployed it on a hosted server where it works until it accesses the MSSQLLocalDB database using a connection string like "Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-Test-123.mdf". This produces the error "The server was not found or was not accessible."

My hosted server's help desk tells me that is because Windows Authentication is not allowed on the shared server and I do not have permissions to attach a database. They have suggested that I create a database and user, backup the database on my development computer and restore it to the hosted database.

I produced the backup with VS2017 and a script like "BACKUP DATABASE [aspnet-Test-123] TO DISK = N'C:\Users\xx\source\repos\Test\Test\App_Data\aspnet-Test-123.bak' WITH NOFORMAT, INIT, NAME = N'Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO".

I attempted to restore the backup on the hosted service which generated the error "The database was backed up on a server running version 13.00.4001. That version is incompatible with this server, which is running version 11.00.3128."

How do I use VS2017 to backup the database to an older version of SQL server? Or, is there another way I can get my VS2017 template project to access its server hosted database?

Unable to save settings

$
0
0

I have VS2017:

First - My settings and toolbox keeps resetting to default

Second - When I try to import I get an error

Your settings were imported, but there were some errors.

Error 1: Accounts: Unable to import property 'Providers' because it contains invalid data ''.

Migration from Clarion.Net (version 10) to C#

$
0
0

Hi,

We have a solution where-in the User-interface of the application has been written in Clarion for .NET (Version 10). The business logic and DAL has been written in C# 4.0.

Now I have no Idea if there is a plug-in to open Clarion Project files (cwproj) with Visual Studio 2017. Google / Bing search returns inconclusive results.

I would like to know the following:

  1. Is there an extension to Visual Studio 2017 that could help me open cwproj projects in VS2017.
  2. Is there a tool or extension from VS or partners that could help me migrate the clarion product to ASP.NET?

Thanks in anticipation,

Yogesh

VS Team Services - website pathway in solution file causing build error

$
0
0

Hi,

This is probably something simple that I am doing wrong as I am new to VSTS. 

I have uploaded my existing .NET website project to VSTS and when I run a build definition in VSTS, I get an error in the solution file.

I can see what the problem is....the solution file has the pathway of the project on my PC in it...which is stored in inetpub/wwwroot/VSProjects on my PC.

Is there something simple I am missing to avoid this?

Thanks for any help...

Here are the build solution log errors -

2018-01-19T16:34:14.3619604Z   C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /PropertyRegister -p ..\..\..\..\..\..\inetpub\wwwroot\VSProjects\PropertyRegister\ -u -f PrecompiledWeb\PropertyRegister\
2018-01-19T16:34:16.1411730Z ##[error]ASPNETCOMPILER(0,0): Error 1003: The directory 'd:\inetpub\wwwroot\VSProjects\PropertyRegister\' doesn't exist.
2018-01-19T16:34:16.1419278Z ASPNETCOMPILER : error 1003: The directory 'd:\inetpub\wwwroot\VSProjects\PropertyRegister\' doesn't exist. [d:\a\3\s\PropertyRegister\PropertyRegister.metaproj]
2018-01-19T16:34:16.1806460Z Done Building Project "d:\a\3\s\PropertyRegister\PropertyRegister.metaproj" (default targets) -- FAILED.
2018-01-19T16:34:16.1818301Z Done Building Project "d:\a\3\s\PropertyRegister\PropertyRegister.sln" (default targets) -- FAILED.
2018-01-19T16:34:16.1837158Z
2018-01-19T16:34:16.1837587Z Build FAILED.
2018-01-19T16:34:16.1873374Z
2018-01-19T16:34:16.1882800Z "d:\a\3\s\PropertyRegister\PropertyRegister.sln" (default target) (1) ->
2018-01-19T16:34:16.1884216Z (ValidateProjects target) ->
2018-01-19T16:34:16.1885795Z   d:\a\3\s\PropertyRegister\PropertyRegister.sln.metaproj : warning MSB4121: The project configuration for project "PropertyRegister" was not specified in the solution file for the solution configuration "Release|Any CPU". [d:\a\3\s\PropertyRegister\PropertyRegister.sln]
2018-01-19T16:34:16.1886267Z

Visual Studio 2017 Step IntoSpecific in System.Web.Mvc.dll not working - is it possible to do or not - please help

$
0
0

I've been trying to Step Into Specific code in System.Web.Mvc.dll. The method I've been trying to step into is the extension method Html.DropDownListFor<>();

I've done almost all I know to do at this point. What else can I try next?

Visual Studio Screenshot

"Enable Just My Code" is turned OFF and "Enable .NET Framework Source Stepping" is turned ON:

Debugger Options Settings

The "Modules" window shows the PDB symbol file has been loaded and it's not optimized:

System.Web.Mvc.dll System.Web.Mvc.dll C:\Users\Guest7\AppData\Local\Temp\Temporary ASP.NET Files\vs\bc62ee6e\cf4f98f3\assembly\dl3\e0da666a\0089091e_d93ad001\System.Web.Mvc.dll No N/A Symbols loaded. C:\Users\Guest7\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols\System.Web.Mvc.pdb\5878be5bda9d485c84ca1f292e2ad75e1\System.Web.Mvc.pdb 24 5.02.30128.0 1/28/2015 5:08 AM 0C780000-0C80E000 [9724] iisexpress.exe [2] /LM/W3SVC/2/ROOT-1-131611064932061001

**EDIT**: I haven't used the Step-Into-Specific feature in a long time and I have another idea about what might be wrong. Maybe actually having the source code for System.Web.Mvc.dll would help? In other words, do I have to download the actual source code for "System.Web.Mvc.dll" somewhere off the Internet and add it to my project first? I was just assuming that all that was handled behind the scenes for me based upon the fact that it happens for some common .DLLs on-the-fly. I do realize that some of those source files are generated using the .DLL in reverse by way of some tricks but none the less, they seem to work.

Viewing all 3509 articles
Browse latest View live


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